/* 
  CoverCraft Premium Style Sheet
  Designed with Rich Glassmorphism, Micro-animations, and Print Optimization
*/

:root {
    /* Color Palette */
    --primary: #1a365d;
    --primary-light: #2b6cb0;
    --primary-glow: rgba(43, 108, 176, 0.15);
    --accent: #0f766e;
    --background: #f8fafc;
    --surface: rgba(255, 255, 255, 0.7);
    --border: rgba(226, 232, 240, 0.8);
    --text: #0f172a;
    --text-muted: #475569;
    
    /* System States */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    /* Font Configurations */
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
    --font-academic: 'Playfair Display', serif;
    
    /* Decorative & Transitions */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 20px -2px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 30px -10px rgba(15, 23, 42, 0.12);
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ================= RESET & GENERAL ================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--background);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ================= BACKGROUND DECORATIONS ================= */
.background-decor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.5;
    animation: rotateDecor 25s infinite alternate ease-in-out;
}

.circle-1 {
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(168, 85, 247, 0.05) 100%);
    top: -10vw;
    left: -10vw;
}

.circle-2 {
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, rgba(20, 184, 166, 0.12) 0%, rgba(59, 130, 246, 0.05) 100%);
    bottom: -10vw;
    right: -10vw;
}

.circle-3 {
    width: 30vw;
    height: 30vw;
    background: radial-gradient(circle, rgba(244, 63, 94, 0.08) 0%, rgba(251, 146, 60, 0.02) 100%);
    top: 30%;
    left: 40%;
}

@keyframes rotateDecor {
    0% { transform: translate(0, 0) rotate(0deg) scale(1); }
    100% { transform: translate(50px, 30px) rotate(180deg) scale(1.1); }
}

/* ================= ENTRANCE / AUTH STYLES ================= */
.auth-page {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.main-container {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 4rem;
    max-width: 1200px;
    width: 100%;
    align-items: center;
}

@media (max-width: 900px) {
    .main-container {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding-top: 1rem;
    }
    .brand-section {
        text-align: center;
    }
    .features-list {
        display: none;
    }
}

/* Left Brand Content */
.brand-section .logo {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 2rem;
}

.logo-icon {
    background: linear-gradient(135deg, #2b6cb0, #0f766e);
    color: white;
    width: 45px;
    height: 45px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    box-shadow: 0 4px 15px rgba(43, 108, 176, 0.3);
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.8rem;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #1a365d, #0f766e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: 3.2rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 1.5rem;
    letter-spacing: -1.5px;
    color: #1e293b;
}

.hero-title span {
    background: linear-gradient(to right, #2b6cb0, #0d9488);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
    font-weight: 400;
}

.features-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #334155;
    font-weight: 500;
}

.feature-icon {
    color: #0d9488;
    font-size: 1.2rem;
}

/* Glassmorphism Card Wrapper */
.auth-card-wrapper {
    perspective: 1000px;
}

.auth-card {
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
}

.auth-card:hover {
    box-shadow: 0 20px 40px -10px rgba(15, 23, 42, 0.18);
    transform: translateY(-2px);
}

.auth-tabs {
    display: flex;
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    margin-bottom: 2rem;
}

.tab-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 0.8rem 0.5rem;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: #1a365d;
    border-bottom-color: #2b6cb0;
}

/* Alerts */
.alert-box {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    background: #fee2e2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    animation: slideDown 0.3s ease-out;
}

.alert-box.success-alert {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.alert-box.info-alert {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.alert-icon {
    font-size: 1.1rem;
}

.alert-msg {
    flex: 1;
}

.alert-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1rem;
}

.hidden {
    display: none !important;
}

/* Form Styling */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    animation: fadeIn 0.4s ease-out;
}

.form-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
}

.form-description {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: -0.8rem;
    margin-bottom: 0.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

input[type="text"],
input[type="password"],
input[type="tel"],
input[type="email"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #cbd5e1;
    background-color: white;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text);
    outline: none;
    transition: var(--transition);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px var(--primary-glow);
}

.password-wrapper {
    position: relative;
}

.password-wrapper input {
    padding-right: 3rem;
}

.toggle-password {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem;
}

.toggle-password:hover {
    color: var(--text-muted);
}

.submit-btn {
    background: linear-gradient(135deg, #1a365d, #2b6cb0);
    color: white;
    border: none;
    padding: 0.9rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    box-shadow: 0 4px 12px rgba(26, 54, 93, 0.2);
    transition: var(--transition);
    margin-top: 1rem;
}

.submit-btn:hover {
    box-shadow: 0 6px 20px rgba(26, 54, 93, 0.3);
    transform: translateY(-1px);
    filter: brightness(1.05);
}

.submit-btn.register-btn {
    background: linear-gradient(135deg, #0f766e, #0d9488);
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.2);
}

.submit-btn.register-btn:hover {
    box-shadow: 0 6px 20px rgba(15, 118, 110, 0.3);
}

.submit-btn.admin-btn {
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    box-shadow: 0 4px 12px rgba(30, 27, 75, 0.2);
}

.submit-btn.admin-btn:hover {
    box-shadow: 0 6px 20px rgba(30, 27, 75, 0.3);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

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

/* =========================================================
   DASHBOARD PAGES & PANELS
========================================================= */

.dashboard-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-color: #f1f5f9;
}

.dashboard-header {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.user-profile-menu {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.profile-info {
    display: flex;
    flex-direction: column;
    text-align: right;
}

.profile-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.95rem;
}

.profile-role {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary-light);
}

.logout-btn {
    background: none;
    border: 1px solid #cbd5e1;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.logout-btn:hover {
    background-color: #fee2e2;
    border-color: #fca5a5;
    color: #ef4444;
}

.dashboard-content {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    pointer-events: none;
}

.toast {
    background: #1e293b;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.9rem;
    min-width: 250px;
    animation: slideInLeft 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
}

.toast.toast-success {
    background: #10b981;
}

.toast.toast-error {
    background: #ef4444;
}

@keyframes slideInLeft {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ================= ADMIN STYLING ================= */
.dashboard-section-header {
    margin-bottom: 2rem;
}

.dashboard-section-header h2 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    color: #1e293b;
    font-weight: 700;
}

.dashboard-section-header p {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 1.2rem;
    border: 1px solid #f1f5f9;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: #eff6ff;
    color: #3b82f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.stat-card.pending .stat-icon {
    background: #fffbeb;
    color: #f59e0b;
}

.stat-card.active .stat-icon {
    background: #ecfdf5;
    color: #10b981;
}

.stat-details {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.dashboard-card {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid #f1f5f9;
    overflow: hidden;
}

.card-header {
    padding: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    color: #1e293b;
}

.icon-btn {
    background: none;
    border: 1px solid #cbd5e1;
    padding: 0.4rem 0.8rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    transition: var(--transition);
}

.icon-btn:hover {
    background-color: #f8fafc;
    border-color: #94a3b8;
}

/* User Table */
.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.users-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.9rem;
}

.users-table th, .users-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

.users-table th {
    font-weight: 600;
    color: #475569;
    background-color: #f8fafc;
}

.users-table tbody tr:hover {
    background-color: #fafafa;
}

.loading-cell {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 3rem !important;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge.badge-pending {
    background-color: #fffbeb;
    color: #b45309;
}

.badge.badge-active {
    background-color: #ecfdf5;
    color: #047857;
}

.badge.badge-admin {
    background-color: #eff6ff;
    color: #1d4ed8;
}

/* Action controls */
.action-btn-sm {
    border: none;
    padding: 0.35rem 0.8rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.action-btn-sm.approve-btn {
    background-color: #10b981;
    color: white;
}

.action-btn-sm.approve-btn:hover {
    background-color: #059669;
}

.action-btn-sm.deactivate-btn {
    background-color: #fee2e2;
    color: #ef4444;
}

.action-btn-sm.deactivate-btn:hover {
    background-color: #fca5a5;
    color: #b91c1c;
}

/* ================= USER DESIGNER STYLING ================= */
.designer-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 1100px) {
    .designer-grid {
        grid-template-columns: 1fr;
    }
}

.editor-card {
    padding: 0;
    position: sticky;
    top: 5rem;
}

.control-tabs {
    display: flex;
    border-bottom: 1px solid #f1f5f9;
}

.control-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 1rem 0.5rem;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
}

.control-tab.active {
    color: var(--primary-light);
    border-bottom-color: var(--primary-light);
}

.control-section {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.editor-split-section {
    display: flex;
    gap: 1rem;
}

.editor-split-section .half {
    flex: 1;
}

.editor-section {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.section-title {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #334155;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title i {
    color: var(--primary-light);
}

/* Color presets */
.color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: 2px solid #cbd5e1;
    border-radius: 50%;
}

.color-presets {
    display: flex;
    gap: 0.5rem;
}

.color-dot {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 1px #cbd5e1;
    cursor: pointer;
    transition: var(--transition);
}

.color-dot:hover {
    transform: scale(1.15);
}

/* Template Options Selection */
.template-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    margin-top: 0.5rem;
}

.temp-option {
    border: 2px solid #cbd5e1;
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.temp-option:hover {
    border-color: #94a3b8;
    background-color: #f8fafc;
}

.temp-option.active {
    border-color: var(--primary-light);
    background-color: var(--primary-glow);
}

.temp-preview {
    width: 100%;
    height: 70px;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
}

.temp-preview.academic {
    flex-direction: column;
    align-items: center;
    justify-content: space-evenly;
}

.temp-preview.academic .line {
    width: 60%;
    height: 3px;
    background: #cbd5e1;
}

.temp-preview.academic .line:nth-child(2) {
    width: 40%;
}

.temp-preview.classic .border-box {
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 2px double #cbd5e1;
}

.temp-preview.minimalist .header-band {
    width: 100%;
    height: 15px;
    background-color: #cbd5e1;
    position: absolute;
    top: 0;
}

.temp-preview.modern .side-band {
    width: 15px;
    height: 100%;
    background-color: #cbd5e1;
    position: absolute;
    left: 0;
}

.temp-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
}

/* History list */
.designs-history-list {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.history-item {
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-sm);
    padding: 0.8rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #f8fafc;
    transition: var(--transition);
}

.history-item:hover {
    border-color: #cbd5e1;
    background-color: white;
}

.history-info {
    display: flex;
    flex-direction: column;
}

.history-title {
    font-weight: 600;
    color: #1e293b;
    font-size: 0.9rem;
}

.history-date {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.history-actions {
    display: flex;
    gap: 0.5rem;
}

.empty-text {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
    font-size: 0.85rem;
    padding: 2rem 0;
}

/* Editor actions footer */
.editor-actions {
    padding: 1.5rem;
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.save-input-group {
    display: flex;
    gap: 0.5rem;
}

.save-input-group input {
    flex: 1;
}

.action-btn {
    border: none;
    border-radius: var(--radius-sm);
    padding: 0.8rem;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.6rem;
    transition: var(--transition);
}

.action-btn.primary-btn {
    background: linear-gradient(135deg, #2b6cb0, #1a365d);
    color: white;
    box-shadow: 0 4px 12px rgba(43, 108, 176, 0.2);
}

.action-btn.primary-btn:hover {
    box-shadow: 0 6px 20px rgba(43, 108, 176, 0.3);
    transform: translateY(-1px);
}

.action-btn.secondary-btn {
    background: white;
    border: 1px solid #cbd5e1;
    color: #475569;
}

.action-btn.secondary-btn:hover {
    border-color: #94a3b8;
    color: #1e293b;
    background-color: #f8fafc;
}

/* Slider Style */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    outline: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary-light);
    cursor: pointer;
    transition: var(--transition);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* =========================================================
   A4 COVER PAGE LIVE PREVIEW
========================================================= */

.designer-preview {
    display: flex;
    justify-content: center;
    overflow-x: auto;
    padding-bottom: 2rem;
}

.a4-sheet {
    width: 21cm;
    height: 29.7cm;
    background-color: white;
    box-shadow: var(--shadow-lg);
    border: 1px solid #e2e8f0;
    position: relative;
    transform-origin: top center;
    display: flex;
    flex-direction: column;
}

.a4-inner-border {
    position: absolute;
    top: 2cm;
    left: 2cm;
    right: 2cm;
    bottom: 2cm;
    border: 4px double var(--primary);
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

/* Preview text classes */
.preview-text {
    transition: font-family 0.2s ease, font-size 0.2s ease;
    word-break: break-word;
}

/* Layout Content Wrapper */
#coverLayoutContent {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 1.5cm;
    text-align: center;
    position: relative;
    height: 100%;
    width: 100%;
}

/* Template Academic style default rules */
.institution-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1cm;
    width: 100%;
}

.display-inst-name {
    font-size: 1.5rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--primary);
    line-height: 1.25;
}

.display-dept-name {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
}

.project-title-box {
    margin: 2cm 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.title-label {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: #64748b;
}

.display-proj-title {
    font-size: 1.8rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
    max-width: 90%;
}

.display-course-name {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--primary-light);
}

.submission-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2cm;
    text-align: left;
    width: 100%;
    margin-bottom: 2cm;
}

.submit-box {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.details-section-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #475569;
    border-bottom: 1px solid #cbd5e1;
    padding-bottom: 0.3rem;
    margin-bottom: 0.2rem;
    letter-spacing: 1px;
}

.details-row {
    display: flex;
    font-size: 0.85rem;
    line-height: 1.4;
}

.details-row .label {
    font-weight: 600;
    color: #64748b;
    width: 90px;
    flex-shrink: 0;
}

.details-row .value {
    color: #1e293b;
    font-weight: 500;
}

.submission-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 1cm;
}

.footer-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: #64748b;
}

.display-sub-date {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1e293b;
}

/* Template 2: Double Border Classic Layout details adjustment */
/* (Classic layout leverages the default academic flex layout but styled differently via JS styling hooks) */

/* Template 3: Minimal Band */
.cover-layout-minimalist {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    padding: 0 !important;
}

.cover-layout-minimalist .institution-header {
    background-color: var(--primary);
    color: white;
    padding: 1.5cm 1cm;
    margin: 0;
    text-align: left;
    align-items: flex-start;
}

.cover-layout-minimalist .display-inst-name {
    color: white !important;
    font-size: 1.4rem;
}

.cover-layout-minimalist .display-dept-name {
    color: rgba(255, 255, 255, 0.8) !important;
}

.cover-layout-minimalist .project-title-box {
    padding: 0 1.5cm;
    align-items: flex-start;
    text-align: left;
}

.cover-layout-minimalist .display-proj-title {
    max-width: 100%;
    font-size: 2rem;
    border-left: 5px solid var(--primary);
    padding-left: 0.8rem;
}

.cover-layout-minimalist .submission-details-grid {
    padding: 0 1.5cm;
    margin-bottom: 1.5cm;
}

.cover-layout-minimalist .submission-footer {
    padding: 0 1.5cm;
    align-items: flex-start;
    margin-bottom: 1.5cm;
}

/* Template 4: Modern Side Band Layout */
.cover-layout-modern {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    padding: 1.5cm 1.5cm 1.5cm 3cm !important;
    text-align: left;
    align-items: flex-start;
}

.cover-layout-modern::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 1.5cm;
    background-color: var(--primary);
}

.cover-layout-modern .institution-header {
    align-items: flex-start;
    text-align: left;
    margin-top: 0.5cm;
}

.cover-layout-modern .project-title-box {
    align-items: flex-start;
    text-align: left;
}

.cover-layout-modern .submission-details-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5cm;
}

.cover-layout-modern .submission-footer {
    align-items: flex-start;
    margin-bottom: 0.5cm;
}

/* =========================================================
   Template 5: College Curved & Leafy Vine Layout
========================================================= */
.cover-layout-college {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 100%;
    height: 100%;
    padding: 1.5cm !important;
    text-align: center;
    align-items: center;
    background: radial-gradient(circle at 50% 50%, #ffffff 0%, #fdfcf7 100%) !important;
    position: relative;
}

/* Curved Header styles */
.college-curved-header {
    display: none;
    width: 100%;
    margin-top: -0.2cm;
    margin-bottom: 0.5cm;
}

.cover-layout-college .college-curved-header {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cover-layout-college .institution-header {
    display: none !important;
}

.college-curved-header svg {
    max-height: 120px;
    width: 100%;
}

.college-curved-header #curvePath {
    stroke: none;
    fill: none;
}

.college-curved-header .display-dept-name {
    margin-top: -10px;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Corner Leafy Vine Flourishes */
.college-corner {
    display: none;
    position: absolute;
    width: 75px;
    height: 75px;
    z-index: 10;
    pointer-events: none;
}

.cover-layout-college .college-corner {
    display: block;
}

/* Rotate / Flip Corners - Positioned safely inside the borders */
.cover-layout-college .corner-tl {
    top: 10px;
    left: 10px;
}

.cover-layout-college .corner-tr {
    top: 10px;
    right: 10px;
    transform: scaleX(-1);
}

.cover-layout-college .corner-bl {
    bottom: 10px;
    left: 10px;
    transform: scaleY(-1);
}

.cover-layout-college .corner-br {
    bottom: 10px;
    right: 10px;
    transform: rotate(180deg);
}

/* College template preview icon */
.temp-preview.college {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.temp-preview.college::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    bottom: 6px;
    border: 1px solid #cbd5e1;
}

.temp-preview.college .curve-indicator {
    width: 35px;
    height: 20px;
    border-top: 2px solid #cbd5e1;
    border-radius: 50% 50% 0 0;
    position: absolute;
    top: 18px;
}

.temp-preview.college::after {
    content: '✿';
    color: #cbd5e1;
    font-size: 8px;
    position: absolute;
    top: 8px;
    left: 8px;
}

/* =========================================================
   PRINT MEDIA RULES (optimized for A4 paper)
========================================================= */

@media print {
    /* Hide everything on the webpage except the A4 Preview Sheet */
    body, html {
        background: white !important;
        color: black !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 21cm !important;
        height: 29.7cm !important;
    }

    .no-print {
        display: none !important;
    }

    .dashboard-page, .dashboard-content {
        padding: 0 !important;
        margin: 0 !important;
        background: none !important;
    }

    .designer-grid {
        display: block !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .designer-preview {
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
        display: block !important;
    }

    .a4-sheet {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        margin: 0 !important;
        border: none !important;
        box-shadow: none !important;
        width: 21cm !important;
        height: 29.7cm !important;
        page-break-after: avoid !important;
        page-break-before: avoid !important;
    }
    
    /* Ensure colors print properly in standard browsers */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    @page {
        size: A4 portrait;
        margin: 0;
    }
}
