:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #f1f5f9;
    --secondary-hover: #e2e8f0;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --bg-main: #f8fafc;
    --white: #ffffff;
    --border: #e2e8f0;
    --success: #10b981;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-dark);
    line-height: 1.6;
}

.dashboard {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--white);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border);
}

.logo {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--primary), #818cf8);
    border-radius: 8px;
}

.brand h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark);
}

.menu {
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-item {
    background: transparent;
    border: none;
    text-align: left;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.2s ease;
}

.menu-item:hover {
    background: var(--secondary);
    color: var(--text-dark);
}

.menu-item.active {
    background: var(--primary);
    color: var(--white);
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

/* Main Content */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 40px;
}

.topbar {
    margin-bottom: 40px;
}

.topbar h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.topbar p {
    color: var(--text-light);
    font-size: 1.05rem;
}

/* Form Container */
.form-container {
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    padding: 40px;
    border: 1px solid var(--border);
}

.form-section {
    display: none;
    animation: fadeIn 0.4s ease;
}

.form-section.active {
    display: block;
}

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

.form-section h2 {
    font-size: 1.5rem;
    margin-bottom: 24px;
    color: var(--primary);
    border-bottom: 2px solid var(--secondary);
    padding-bottom: 8px;
}

.subtitle {
    margin-bottom: 20px;
    color: var(--text-light);
}

/* Grid & Inputs */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.input-group.full-width {
    grid-column: 1 / -1;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

label {
    font-weight: 500;
    font-size: 1.1rem;
    color: var(--primary);
}

input[type="text"],
input[type="date"],
textarea,
select {
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
    background: var(--white);
    outline: none;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

textarea {
    white-space: normal;
    overflow: auto;
}

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

/* Checkboxes */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 1rem;
}

.checkbox-label input {
    display: none;
}

.custom-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.checkbox-label input:checked + .custom-checkbox {
    background: var(--primary);
    border-color: var(--primary);
}

.checkbox-label input:checked + .custom-checkbox::after {
    content: "✓";
    color: white;
    font-size: 14px;
}

/* Buttons */
.form-actions {
    margin-top: 40px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
}

button {
    cursor: pointer;
    font-family: inherit;
}

.btn-primary, .btn-secondary, .btn-generate {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border: none;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.85rem;
    margin-top: 4px;
    width: fit-content;
}

.btn-primary {
    background: var(--primary);
    color: white;
    margin-left: auto;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--text-dark);
}

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

/* Generate Card */
.generate-card {
    text-align: center;
    padding: 40px;
    background: var(--secondary);
    border-radius: 12px;
    margin-top: 24px;
}

.icon-doc {
    font-size: 4rem;
    margin-bottom: 16px;
}

.btn-generate {
    background: linear-gradient(135deg, var(--primary), #6366f1);
    color: white;
    font-size: 1.1rem;
    padding: 16px 32px;
    margin-top: 24px;
    box-shadow: 0 4px 15px rgba(79, 70, 229, 0.3);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

.success-msg {
    margin-top: 20px;
    color: var(--success);
    font-weight: 600;
    font-size: 1.1rem;
    animation: fadeIn 0.4s ease;
}

select, option {
    font-size: 0.85rem;
    white-space: normal;
    word-wrap: break-word;
    height: auto;
    text-overflow: clip;
    overflow: visible;
}


/* Responsiveness */
@media (max-width: 900px) {
    .dashboard {
        flex-direction: column;
        height: auto;
        overflow: visible;
    }
    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .menu {
        max-height: 250px;
        overflow-y: auto;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .menu-item {
        flex: 1 1 calc(50% - 10px);
        text-align: center;
    }
    .content {
        padding: 20px;
        overflow-y: visible;
    }
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    .topbar h1 {
        font-size: 1.5rem;
    }
    .menu-item {
        flex: 1 1 100%;
    }
}

.school-info-notice { margin: 8px 0 0; font-size: 0.9rem; line-height: 1.5; }
@media print { .school-info-notice { display: none !important; } }
