:root {
    --primary: #d6b133;
    --primary-hover: #b8962b;
    --bg-app: #f8fafc;
    --bg-card: rgba(255, 255, 255, 0.8);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.4);
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    overflow-x: hidden;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: 400px;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border-right: 1px solid var(--border);
    padding: 2rem;
    height: 100vh;
    overflow-y: auto;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar header h1 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.sidebar header p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 2rem;
}

.form-group h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.input-field {
    margin-bottom: 1rem;
}

.input-field label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.35rem;
}

.input-field input,
.input-field select {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.875rem;
    transition: all 0.2s;
    background-color: white;
}

.input-field input:focus,
.input-field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(214, 177, 51, 0.1);
}

#teacher-dept-custom {
    font-size: 0.8rem;
    padding: 0.5rem;
}

.primary-btn {
    width: 100%;
    padding: 0.75rem;
    background-color: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 1rem;
}

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

.secondary-btn {
    width: 100%;
    padding: 0.75rem;
    background-color: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 0.75rem;
}

.secondary-btn:hover {
    background-color: #fee2e2;
    color: #ef4444;
    border-color: #fecaca;
}

/* Preview Area */
.preview-area {
    flex: 1;
    display: flex;
    justify-content: center;
    padding: 3rem;
    background-color: #e2e8f0;
    overflow-y: auto;
}

.a4-page {
    width: 210mm;
    height: 297mm;
    background-color: white;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    padding: 2.5cm;
    position: relative;
    display: flex;
    flex-direction: column;
    transform-origin: top center;
}

.border-top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background-color: var(--primary);
}

.cover-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    color: #111;
}

.header-section {
    margin-bottom: 3rem;
}

.logo-image {
    width: 100px;
    height: auto;
    margin: 0 auto 1.5rem;
}

#logo-img {
    width: 100%;
    height: auto;
    display: block;
}

.uni-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.dept-display {
    font-size: 1.1rem;
    font-weight: 600;
    color: #334155;
}

.title-section {
    margin: 4rem 0;
    width: 100%;
}

.title-section .label {
    font-size: 1rem;
    font-style: italic;
    margin-bottom: 0.5rem;
    color: #64748b;
}

.assignment-val {
    font-size: 1.7rem;
    font-weight: 800;
    line-height: 1.4;
    padding: 0.75rem 0;
    border-top: 2px solid #eee;
    border-bottom: 2px solid #eee;
}

.course-section {
    margin-bottom: 4rem;
    text-align: left;
    width: 100%;
    padding: 0 2rem;
}

.course-section p {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.person-info {
    display: flex;
    justify-content: space-between;
    width: 100%;
    text-align: left;
    margin-top: auto;
    padding: 0 2rem;
}

.person-info h4 {
    font-size: 1.2rem;
    text-decoration: underline;
    margin-bottom: 0.75rem;
}

.person-info p {
    font-size: 1.15rem;
    margin-bottom: 0.25rem;
}

.person-info .name {
    font-weight: 700;
    font-size: 1.2rem;
}

.footer-section {
    margin-top: 4rem;
    font-size: 1.15rem;
}

/* Print Styles */
@media print {
    @page {
        size: A4;
        margin: 0;
    }

    html, body {
        width: 210mm;
        height: 297mm;
        margin: 0;
        padding: 0;
        background: white !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    body {
        text-rendering: optimizeLegibility;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    .sidebar, .modal-overlay, .mobile-nav {
        display: none !important;
    }

    .app-container {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .preview-area {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        width: 210mm !important;
        height: 297mm !important;
        padding: 0 !important;
        margin: 0 !important;
        background: none !important;
        display: block !important;
        overflow: visible !important;
        transform: none !important;
    }

    .a4-page {
        box-shadow: none !important;
        width: 210mm !important;
        height: 297mm !important;
        margin: 0 !important;
        padding: 2.5cm !important;
        border: none !important;
        transform: none !important;
        visibility: visible !important;
        display: flex !important;
        position: relative !important;
        left: 0 !important;
        top: 0 !important;
        page-break-after: always;
    }

    .assignment-val {
        border-top: 1.5pt solid #eee !important;
        border-bottom: 1.5pt solid #eee !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .border-top {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        background-color: var(--primary) !important;
    }
}

/* Responsive Scaling for Preview */
@media (max-width: 1200px) {
    .a4-page {
        transform: scale(0.8);
    }
}

/* Custom Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
    display: none;
    opacity: 0;
}

.modal-content {
    background: white;
    padding: 2.5rem;
    border-radius: 16px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
}

.modal-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.modal-content h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.modal-content p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 2rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
}

.modal-btn {
    flex: 1;
    padding: 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.modal-btn.secondary {
    background: #f1f5f9;
    color: var(--text-muted);
}

.modal-btn.secondary:hover {
    background: #e2e8f0;
}

.modal-btn.primary {
    background: #ef4444;
    color: white;
}

.modal-btn.primary:hover {
    background: #dc2626;
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }


    .sidebar {
        width: 100%;
        height: auto;
        position: static;
    }

    .a4-page {
        transform: scale(0.6);
    }
}