/* Modern Study Guide Generator - Sleek Design System */

/* Import modern font */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* CSS Variables for consistent theming */
:root {
    /* Colors - Elegant purple/blue gradient theme */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --accent-color: #4f46e5;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;

    /* Neutral colors */
    --bg-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.95);
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: rgba(148, 163, 184, 0.2);

    /* Shadows and effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Animated background gradient */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    opacity: 0.05;
    z-index: -1;
}

/* Container - Optimized for above-the-fold content */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    animation: fadeIn 0.5s ease-out;
}

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

/* Header - Compact for better UX */
.header {
    text-align: center;
    margin-bottom: 1rem;
    padding: 0;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.25rem;
    animation: slideDown 0.6s ease-out;
}

.header .subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 400;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* Footer styles */
.footer {
    background: #f8f9fa;
    padding: 2rem 0;
    margin-top: 4rem;
    border-top: 1px solid #e2e8f0;
    text-align: center;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
}

.footer a {
    color: #7c3aed;
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Active nav link */
.nav-links a.active {
    color: #7c3aed;
    font-weight: 600;
}

/* Premium badge */
.premium-badge {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin: 0 0.5rem;
}

/* Alert close button */
.close-alert {
    float: right;
    font-size: 1.5rem;
    font-weight: bold;
    line-height: 1;
    color: #000;
    opacity: 0.5;
    cursor: pointer;
    background: none;
    border: none;
}

.close-alert:hover {
    opacity: 0.8;
}
/* Card Component - Reduced padding */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.card-header {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--border-color);
}

.card-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.card-header .icon {
    width: 30px;
    height: 30px;
    margin-right: 1rem;
    background: var(--primary-gradient);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

/* Form Styles - Tighter spacing */
.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.95rem;
}

/* File Upload Area - Fixed alignment */
.file-upload-area {
    position: relative;
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: var(--transition);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    cursor: pointer;
}

.file-upload-area .upload-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.file-upload-area .upload-text {
    text-align: left;
}

.file-upload-area:hover {
    border-color: var(--accent-color);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
}

.file-upload-area.dragover {
    border-color: var(--accent-color);
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    transform: scale(1.02);
}

.upload-icon {
    width: 40px;
    height: 40px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.file-upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.file-info {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(79, 70, 229, 0.05) 100%);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.file-info span:first-child {
    font-weight: 500;
    color: var(--text-primary);
}

.testimonials-section {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
}

.testimonial {
    padding: 1rem;
    margin-bottom: 1rem;
    background: white;
    border-left: 3px solid var(--accent-color);
    border-radius: 5px;
}

.testimonial p {
    font-style: italic;
    margin-bottom: 0.5rem;
}

.testimonial small {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Select and Input Styles */
select, input[type="text"], input[type="number"] {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: 1rem;
    font-family: inherit;
    transition: var(--transition);
    background: white;
}

select:focus, input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Radio Group */
.radio-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.radio-option {
    position: relative;
    flex: 1;
    min-width: 120px;
}

.radio-option input[type="radio"] {
    position: absolute;
    opacity: 0;
}

.radio-option label {
    display: block;
    padding: 0.75rem 1rem;
    text-align: center;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.radio-option input[type="radio"]:checked + label {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
}

.radio-option label:hover {
    border-color: var(--accent-color);
}

/* Buttons */
.btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-color);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Button Group */
.button-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.alert-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1) 0%, rgba(5, 150, 105, 0.1) 100%);
    border-left: 4px solid var(--success-color);
    color: #065f46;
}

.alert-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.1) 0%, rgba(220, 38, 38, 0.1) 100%);
    border-left: 4px solid var(--error-color);
    color: #991b1b;
}

.alert-info {
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(79, 70, 229, 0.05) 100%);
    border-left: 4px solid var(--accent-color);
    color: #312e81;
}

/* Output Display */
.output-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-top: 2rem;
    border: 1px solid var(--border-color);
    max-height: 600px;
    overflow-y: auto;
}

.output-container::-webkit-scrollbar {
    width: 8px;
}

.output-container::-webkit-scrollbar-track {
    background: var(--bg-color);
    border-radius: 10px;
}

.output-container::-webkit-scrollbar-thumb {
    background: var(--primary-gradient);
    border-radius: 10px;
}

.output-container h1, .output-container h2, .output-container h3 {
    color: var(--text-primary);
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.output-container h1 {
    font-size: 1.8rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.output-container h2 {
    font-size: 1.4rem;
    color: var(--accent-color);
}

.output-container p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.output-container ul, .output-container ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.output-container li {
    margin-bottom: 0.5rem;
}

/* Loading Spinner */
.loading {
    display: none;
    text-align: center;
    padding: 2rem;
}

.loading.active {
    display: block !important;
    animation: fadeIn 0.3s ease-out;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Copy Button */
.copy-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    padding: 0.5rem 1rem;
    background: var(--primary-gradient);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: var(--transition);
}

.copy-btn:hover {
    transform: scale(1.05);
}

.copy-btn.copied {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header h1 {
        font-size: 2rem;
    }

    .card {
        padding: 1.5rem;
    }

    .button-group {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* Responsive testimonials */
@media (max-width: 900px) {
    /* Stack vertically on tablets and phones */
    div[style*="grid-template-columns: 1fr 300px"] {
        display: block !important;
    }

    /* Make testimonial card full width and show before main content */
    div[style*="position: sticky"] {
        position: relative !important;
        margin-bottom: 1rem;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .btn, .button-group {
        display: none;
    }
}

/* Animations for elements */
.fade-in {
    animation: fadeIn 0.5s ease-out;
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

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

/* Progress Steps - Compact */
.progress-steps {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.step {
    flex: 1;
    text-align: center;
    position: relative;
}

.step-number {
    width: 32px;
    height: 32px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 0.3rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: var(--transition);
}

.step.active .step-number {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
}

.step.completed .step-number {
    background: var(--success-color);
    color: white;
    border-color: transparent;
}

.step-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.step.active .step-label {
    color: var(--text-primary);
    font-weight: 500;
}

/* Fix all textarea font sizes */
textarea {
    font-size: 1rem !important;
    font-family: inherit;
}

.navbar .btn {
    padding: 0.5rem 1rem !important;
    font-size: 0.9rem !important;
    white-space: nowrap;
    min-height: 36px; /* Consistent height */
    display: inline-flex;
    align-items: center; /* Center text vertically */
    line-height: 1.2; /* Prevent double-row text */
}

/* Mobile Navigation Fixes */
@media (max-width: 768px) {
    /* Make the navbar horizontally scrollable */
    .navbar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
        white-space: nowrap;
        padding: 0.5rem;
    }

    /* Keep nav items in a single row */
    .nav-container {
        display: flex;
        justify-content: space-between;
        align-items: center;
        min-width: fit-content;
        padding: 0 0.5rem;
    }

    .nav-left {
        display: flex;
        gap: 0.5rem;
        align-items: center;
        flex-wrap: nowrap !important;
    }

    .nav-right {
        display: flex;
        gap: 0.5rem;
        align-items: center;
        flex-wrap: nowrap !important;
        margin-left: 1rem;
    }

    /* Smaller buttons on mobile */
    .navbar .btn {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.85rem !important;
        min-height: 32px;
    }

    /* If you need some buttons to wrap */
    .navbar .btn.allow-wrap {
        white-space: normal;
        text-align: center;
        max-width: 100px; /* Control width */
    }

    .navbar .nav-brand {
        font-size: 1.2rem !important;
        margin-right: 0.5rem;
        white-space: nowrap;
    }

    /* Hide less important items on very small screens */
    @media (max-width: 480px) {
        .navbar .btn-secondary {
            padding: 0.4rem 0.6rem !important;
            font-size: 0.8rem !important;
        }

        /* Optionally hide "Success Stories" on very small screens */
        .nav-left a[href*="success_stories"] {
            display: none;
        }
    }

    /* Visual scroll indicator */
    .navbar::after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 20px;
        background: linear-gradient(to right, transparent, rgba(255,255,255,0.9));
        pointer-events: none;
        z-index: 1;
    }

    /* Hide the gradient when scrolled to the end */
    .navbar.scrolled-end::after {
        display: none;
    }
}

/* Ensure navbar stays fixed properly */
@media (max-width: 768px) {
    #main-content {
        padding-top: 70px !important; /* Adjust based on actual navbar height */
    }
}

/* Fix promo code form on mobile */
@media (max-width: 768px) {
    /* Target the specific promo code form */
    form[action*="apply_code"] input[name="promo_code"] {
        flex: 1 1 70% !important;
        min-width: 0 !important;
    }

    form[action*="apply_code"] button[type="submit"] {
        flex: 0 0 auto !important;
        padding: 0.5rem 0.75rem !important;
        width: auto !important;
        max-width: 70px !important;
        font-size: 0.85rem !important;
    }
}

@media (max-width: 480px) {
    form[action*="apply_code"] button[type="submit"] {
        padding: 0.4rem 0.6rem !important;
        max-width: 60px !important;
        font-size: 0.8rem !important;
    }
}

/* Responsive tables */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.admin-table {
    min-width: 600px;
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    text-align: left !important;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.admin-table th {
    font-weight: 600;
    background: var(--bg-color);
}

@media (max-width: 768px) {
    .table-wrapper {
        margin: 0 -1rem;
        padding: 0 1rem;
    }
}
