/* Reset and Base Styles */
* {
    box-sizing: border-box;
}

/* Fade-in animation */
.fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* Hide number input arrows */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* Message styles */
#ttg-message {
    margin: 0 24px 16px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}

#ttg-message.error {
    background-color: #fee2e2;
    color: #dc2626;
    border: 1px solid #fca5a5;
}

#ttg-message.success {
    background-color: #d1fae5;
    color: #059669;
    border: 1px solid #6ee7b7;
}

/* General Container with Background Pattern */
#ttg-container {
    max-width: 700px;
    margin: 30px auto;
    padding: 60px 15px;
    font-family: Yekta, "IRANSans", Tahoma, "Segoe UI", Roboto, sans-serif;
    direction: rtl;
    text-align: right;
    position: relative;
    right: 25%;
    min-height: calc(100vh - 60px);
}

/* Form Card with Transparent Background */
.ttg-form-card {
    background: rgba(255, 255, 255, 0.85);
    background-color: #1e40af59;
    backdrop-filter: blur(7px);
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    padding: 0;
    margin: 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

/* Form Header - Simple */
.ttg-form-header {
    padding: 35px 35px 20px;
    text-align: center;
    position: relative;
}

.ttg-form-header h2 {
    color: #5b52f1;
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 15px;
    line-height: 1.4;
}

/* Header Line */
.ttg-header-line {
    width: 60px;
    height: 3px;
    background: #d7d8e1;
    margin: 0 auto;
    border-radius: 2px;
}

/* Form */
#ttg-form {
    padding: 0 35px 35px;
}

/* Form Rows - Two Column Layout */
.ttg-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

/* Field Groups */
.ttg-field-group {
    margin-bottom: 20px;
}

.ttg-field-half {
    margin-bottom: 0;
}

.ttg-field-group label {
    display: flex;
    align-items: center;
    font-weight: 600;
    margin-bottom: 8px;
    color: #ffffff;
    font-size: 14px;
}

.ttg-label-icon {
    font-size: 18px;
    margin-left: 6px;
    display: inline-flex;
}

/* Inputs */
#ttg-form input[type="text"],
#ttg-form select,
#ttg-form input[type="email"],
#ttg-form input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    box-sizing: border-box;
    transition: all 0.2s ease;
    background-color: #ffffff;
    color: #1e293b;
    font-size: 14px;
    font-family: Yekta, "IRANSans", Tahoma, sans-serif;
}

#ttg-form input[type="text"]:hover,
#ttg-form select:hover,
#ttg-form input[type="email"]:hover,
#ttg-form input[type="password"]:hover {
    border-color: #cbd5e1;
}

#ttg-form input[type="text"]:focus,
#ttg-form select:focus,
#ttg-form input[type="email"]:focus,
#ttg-form input[type="password"]:focus {
    border-color: #4f46e5;
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

#ttg-form select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%23334155' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 14px center;
    padding-left: 36px;
}

/* Radio Buttons */
.ttg-radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ttg-radio-label {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    background: #f8fafc;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0;
}

.ttg-radio-label:hover {
    background: #ffffff;
    border-color: #cbd5e1;
}

.ttg-radio-label input[type="radio"] {
    display: none;
}

.ttg-radio-custom {
    width: 18px;
    height: 18px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    margin-left: 10px;
    position: relative;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ttg-radio-label input[type="radio"]:checked + .ttg-radio-custom {
    border-color: #4f46e5;
}

.ttg-radio-label input[type="radio"]:checked + .ttg-radio-custom::before {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: #4f46e5;
    border-radius: 50%;
    top: 50%;
    right: 50%;
    transform: translate(50%, -50%);
}

.ttg-radio-label:has(input[type="radio"]:checked) {
    background: #f0f4ff;
    border-color: #4f46e5;
}

.ttg-radio-text {
    font-weight: 500;
    color: #334155;
    font-size: 13px;
    user-select: none;
}

/* Submit Button - Combined Price and Payment */
#ttg-submit-button {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    flex-wrap: wrap;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.ttg-price-display {
    font-weight: 600;
    color: #ffffff;
}

.ttg-price-display #ttg-price {
    color: #fbbf24;
    font-weight: 700;
    font-size: 18px;
}

.ttg-button-text {
    color: #ffffff;
}

#ttg-submit-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(79, 70, 229, 0.5);
    background: linear-gradient(135deg, #4338ca 0%, #5b52f1 100%);
}

#ttg-submit-button:active {
    transform: translateY(0);
}

#ttg-submit-button:disabled {
    background: #e2e8f0;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* Loader */
#ttg-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    color: #ffffff;
    font-weight: 500;
}

.ttg-spinner {
    border: 3px solid rgba(255, 255, 255, 0.15);
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border-top-color: #ffffff;
    animation: spin 0.8s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Message Area */
#ttg-message {
    margin-top: 20px;
    padding: 14px 18px;
    border-radius: 10px;
    text-align: center;
    font-weight: 500;
    font-size: 14px;
}

#ttg-message.error {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    color: #dc2626;
    border: 1.5px solid #fca5a5;
}

#ttg-message.success {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #059669;
    border: 1.5px solid #34d399;
}

/* Results Container */
.ttg-results-container {
    max-width: 700px;
    margin: 30px auto;
    padding: 35px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.ttg-results-container h2 {
    color: #4f46e5;
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 24px;
    font-weight: 700;
    padding-bottom: 12px;
    border-bottom: 2px solid #4f46e5;
}

.ttg-results-container.ttg-error-container {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border: 2px solid #fca5a5;
}

.ttg-results-container.ttg-error-container h2 {
    color: #dc2626;
    border-color: #fca5a5;
}

.ttg-topic-card {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-right: 4px solid #4f46e5;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ttg-topic-card:hover {
    transform: translateX(-4px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.15);
    border-color: #cbd5e1;
}

.ttg-topic-number {
    font-size: 20px;
    font-weight: 700;
    color: #4f46e5;
    margin-left: 20px;
    min-width: 36px;
    text-align: center;
}

.ttg-topic-text {
    flex-grow: 1;
    margin: 0;
    color: #1e293b;
    line-height: 1.8;
    font-size: 15px;
    font-weight: 500;
}

.ttg-copy-btn,
.ttg-retry-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
}

.ttg-copy-btn:hover,
.ttg-retry-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(79, 70, 229, 0.3);
}

.ttg-copy-btn:active,
.ttg-retry-btn:active {
    transform: translateY(0);
}

/* AI Areas Section */
#ttg-areas-list label {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0;
}

#ttg-areas-list label:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

#ttg-areas-list input[type="radio"] {
    margin-left: 10px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

#ttg-areas-list label:has(input[type="radio"]:checked) {
    background: #f0f4ff;
    border-color: #4f46e5;
}

#ttg-get-areas-btn:disabled {
    background: #e2e8f0 !important;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Custom Areas Textarea */
#ttg-custom-areas {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    box-sizing: border-box;
    transition: all 0.2s ease;
    background-color: #ffffff;
    color: #1e293b;
    font-size: 14px;
    font-family: Yekta, "IRANSans", Tahoma, sans-serif;
    resize: vertical;
}

#ttg-custom-areas:focus {
    border-color: #4f46e5;
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Methodology Custom Textarea */
#ttg-methodology-custom-input {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    box-sizing: border-box;
    transition: all 0.2s ease;
    background-color: #ffffff;
    color: #1e293b;
    font-size: 14px;
    font-family: Yekta, "IRANSans", Tahoma, sans-serif;
    resize: vertical;
}

#ttg-methodology-custom-input:focus {
    border-color: #4f46e5;
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Feedback Textarea */
#ttg-feedback {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    box-sizing: border-box;
    transition: all 0.2s ease;
    background-color: #ffffff;
    color: #1e293b;
    font-size: 14px;
    font-family: Yekta, "IRANSans", Tahoma, sans-serif;
    resize: vertical;
}

#ttg-feedback:focus {
    border-color: #4f46e5;
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Feedback Button */
#ttg-feedback-btn {
    transition: all 0.2s ease;
}

#ttg-feedback-btn:hover {
    background: #475569 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.3);
}

#ttg-feedback-btn:active {
    transform: translateY(0);
}

/* Responsive - Mobile First */
@media (max-width: 768px) {
    #ttg-container {
        margin: 20px 10px;
        padding: 20px 10px;
        right: 0;
    }

    .ttg-form-card {
        border-radius: 20px;
    }

    .ttg-form-header {
        padding: 30px 25px 20px;
    }

    .ttg-form-header h2 {
        font-size: 18px;
    }

    #ttg-form {
        padding: 0 25px 25px;
    }

    .ttg-form-row {
        grid-template-columns: 1fr;
        gap: 0;
        margin-bottom: 0;
    }

    .ttg-field-half {
        margin-bottom: 20px;
    }

    #ttg-submit-button {
        padding: 12px 18px;
        font-size: 14px;
        flex-direction: column;
        text-align: center;
    }

    .ttg-price-display, .ttg-button-text {
        display: block;
    }

    .ttg-topic-card {
        flex-direction: column;
        align-items: flex-start;
        padding: 14px 18px;
    }

    .ttg-topic-number {
        margin: 0 0 12px 0;
    }

    .ttg-topic-text {
        margin-bottom: 14px;
        font-size: 14px;
    }

    .ttg-copy-btn,
    .ttg-retry-btn {
        width: 100%;
        text-align: center;
        padding: 12px 20px;
    }
}

@media (max-width: 480px) {
    .ttg-form-header {
        padding: 25px 20px 15px;
    }

    #ttg-form {
        padding: 0 20px 20px;
    }

    .ttg-form-header h2 {
        font-size: 16px;
    }

    #ttg-submit-button {
        font-size: 13px;
        padding: 10px 15px;
    }
}
