/* ==========================================================================
   DESIGN SYSTEM - CLUBE DE LEITURA
   Theme: Cozy Modern Library (Obsidian, Warm Amber & Gold Accent)
   ========================================================================== */

:root {
    /* Color Palette - Premium HSL Colors */
    --bg-obsidian: #0b0a09;
    --bg-obsidian-rgb: 11, 10, 9;
    
    --bg-panel: #141210;
    --bg-panel-rgb: 20, 18, 16;
    
    --card-bg: rgba(22, 20, 18, 0.52);
    --card-border: rgba(229, 169, 91, 0.12);
    --card-border-focus: rgba(229, 169, 91, 0.45);
    
    /* Warm Gold / Amber Accent Gradient */
    --accent-gold-start: #e5a95b;
    --accent-gold-end: #a87232;
    --accent-gradient: linear-gradient(135deg, var(--accent-gold-start) 0%, var(--accent-gold-end) 100%);
    
    /* Functional Colors */
    --text-primary: #f5f5f7;
    --text-secondary: #a8a29e;
    --text-muted: #78716c;
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --success-border: rgba(16, 185, 129, 0.25);
    
    --error: #ef4444;
    --error-bg: rgba(239, 68, 68, 0.1);
    --error-border: rgba(239, 68, 68, 0.25);
    
    /* Typography */
    --font-primary: 'Outfit', sans-serif;
    --font-serif: 'Playfair Display', serif;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
    --shadow-glow: 0 0 25px rgba(229, 169, 91, 0.2);
    
    /* Transitions */
    --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   BASE & RESET
   ========================================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-primary);
    background-color: var(--bg-obsidian);
    background-image: linear-gradient(
        to bottom,
        rgba(var(--bg-obsidian-rgb), 0.65) 0%,
        rgba(var(--bg-obsidian-rgb), 0.88) 100%
    ), url('background.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* Ambient glow blobs */
.ambient-glow {
    position: fixed;
    width: 60vw;
    height: 60vh;
    border-radius: 50%;
    filter: blur(140px);
    z-index: -1;
    pointer-events: none;
    opacity: 0.12;
}

.glow-1 {
    top: -20vh;
    left: -10vw;
    background: radial-gradient(circle, var(--accent-gold-start) 0%, transparent 70%);
}

.glow-2 {
    bottom: -20vh;
    right: -10vw;
    background: radial-gradient(circle, #78350f 0%, transparent 70%);
}

/* ==========================================================================
   APP SHELL
   ========================================================================== */

#app-container {
    width: 100%;
    min-height: 100vh;
    position: relative;
}

.app-screen {
    width: 100%;
    min-height: 100vh;
    display: none;
    padding: 2rem;
    transition: opacity var(--transition-smooth);
}

.app-screen.active {
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   GLASSMORPHISM CARD
   ========================================================================== */

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px) saturate(120%);
    -webkit-backdrop-filter: blur(20px) saturate(120%);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.glass-card:hover {
    border-color: rgba(229, 169, 91, 0.2);
}

/* ==========================================================================
   LOGIN SCREEN
   ========================================================================== */

#login-screen {
    justify-content: center;
    align-items: center;
}

.login-card {
    width: 100%;
    max-width: 440px;
    padding: 3.5rem 2.5rem;
    box-shadow: var(--shadow-lg);
}

.brand-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.brand-logo {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 72px;
    height: 72px;
    border-radius: 20px;
    background: var(--accent-gradient);
    font-size: 2.25rem;
    color: var(--bg-obsidian);
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-glow);
    animation: pulse-glow 3s infinite alternate;
}

.brand-title {
    font-family: var(--font-serif);
    font-size: 2.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.brand-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-weight: 500;
}

/* ==========================================================================
   FORMS & INPUTS
   ========================================================================== */

.input-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding-left: 0.25rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    width: 100%;
    background: rgba(var(--bg-obsidian-rgb), 0.5);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.9rem 1rem 0.9rem 2.75rem;
    font-family: var(--font-primary);
    font-size: 0.95rem;
    color: var(--text-primary);
    outline: none;
    transition: all var(--transition-fast);
}

.input-wrapper input:focus {
    border-color: var(--card-border-focus);
    background: rgba(var(--bg-obsidian-rgb), 0.8);
    box-shadow: 0 0 12px rgba(229, 169, 91, 0.15);
}

.input-wrapper input::placeholder {
    color: var(--text-muted);
}

.input-icon {
    position: absolute;
    left: 1rem;
    font-size: 1.1rem;
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--transition-fast);
}

.input-wrapper input:focus + .input-icon {
    color: var(--accent-gold-start);
}

/* Disabled input state */
.input-wrapper.disabled input {
    background: rgba(var(--bg-panel-rgb), 0.8);
    color: var(--text-muted);
    cursor: not-allowed;
    border-color: rgba(229, 169, 91, 0.05);
}

.input-hint {
    font-size: 0.775rem;
    color: var(--text-muted);
    padding-left: 0.25rem;
    margin-top: -0.25rem;
}

/* Password Toggle */
.password-toggle-btn {
    position: absolute;
    right: 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 6px;
    transition: color var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle-btn:hover {
    color: var(--text-primary);
}

/* Multiline Textarea */
.textarea-wrapper {
    position: relative;
    display: flex;
}

.textarea-wrapper textarea {
    width: 100%;
    background: rgba(var(--bg-obsidian-rgb), 0.5);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0.9rem 1rem 0.9rem 2.75rem;
    font-family: var(--font-primary);
    font-size: 0.95rem;
    color: var(--text-primary);
    outline: none;
    resize: vertical;
    min-height: 100px;
    transition: all var(--transition-fast);
}

.textarea-wrapper textarea:focus {
    border-color: var(--card-border-focus);
    background: rgba(var(--bg-obsidian-rgb), 0.8);
    box-shadow: 0 0 12px rgba(229, 169, 91, 0.15);
}

.textarea-icon {
    position: absolute;
    left: 1rem;
    top: 1.05rem;
    font-size: 1.1rem;
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--transition-fast);
}

.textarea-wrapper textarea:focus + .textarea-icon {
    color: var(--accent-gold-start);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-primary);
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.9rem 1.75rem;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: var(--bg-obsidian);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-glow), var(--shadow-md);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: rgba(229, 169, 91, 0.08);
    border: 1px solid rgba(229, 169, 91, 0.15);
    color: var(--accent-gold-start);
}

.btn-secondary:hover {
    background: rgba(229, 169, 91, 0.15);
    color: var(--text-primary);
}

.btn-block {
    width: 100%;
}

/* ==========================================================================
   ALERT BOXES
   ========================================================================== */

.alert-box {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: 12px;
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.alert-error {
    background-color: var(--error-bg);
    border: 1px solid var(--error-border);
    color: #fca5a5;
}

.alert-success {
    background-color: var(--success-bg);
    border: 1px solid var(--success-border);
    color: #a7f3d0;
}

.hidden {
    display: none !important;
}

/* ==========================================================================
   MAIN DASHBOARD SCREEN
   ========================================================================== */

#main-screen.active {
    display: flex;
    flex-direction: row;
    padding: 0;
    width: 100%;
    min-height: 100vh;
    background: transparent;
}

/* Sidebar Styling */
.sidebar {
    width: 280px;
    background: rgba(20, 18, 16, 0.72);
    backdrop-filter: blur(24px) saturate(120%);
    -webkit-backdrop-filter: blur(24px) saturate(120%);
    border-right: 1px solid var(--card-border);
    padding: 2.5rem 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 2.5rem;
    flex-shrink: 0;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-brand-logo {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--accent-gradient);
    font-size: 1.25rem;
    color: var(--bg-obsidian);
    box-shadow: var(--shadow-glow);
}

.sidebar-brand-title {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
}

.sidebar-user {
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
    background: rgba(229, 169, 91, 0.04);
    border: 1px solid rgba(229, 169, 91, 0.08);
    border-radius: 16px;
}

.user-greeting-subtitle {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    font-weight: 600;
}

.user-display-name {
    font-family: var(--font-primary);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--accent-gold-start);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 0.25rem;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.sidebar-menu-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.25rem;
    border-radius: 12px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-fast);
}

.sidebar-menu-item i {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    transition: color var(--transition-fast);
}

.sidebar-menu-item:hover {
    background: rgba(229, 169, 91, 0.06);
    color: var(--text-primary);
}

.sidebar-menu-item.active {
    background: var(--accent-gradient);
    color: var(--bg-obsidian);
    box-shadow: var(--shadow-glow);
}

.sidebar-menu-item.active i {
    color: var(--bg-obsidian);
}

.sidebar-menu-item.menu-item-logout {
    margin-top: auto;
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.04);
    border: 1px solid rgba(239, 68, 68, 0.08);
}

.sidebar-menu-item.menu-item-logout:hover {
    background: #ef4444;
    color: #0b0a09;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.25);
    border-color: transparent;
}

/* Main Content Styling */
.main-content {
    flex: 1;
    padding: 3rem;
    overflow-y: auto;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.content-view {
    width: 100%;
    margin: 0 auto;
}

.content-view.hidden {
    display: none !important;
}

.view-card {
    padding: 3rem 2.5rem;
    border-color: rgba(229, 169, 91, 0.08);
    width: 100%;
}

.view-header {
    margin-bottom: 2rem;
    border-bottom: 1px solid rgba(229, 169, 91, 0.08);
    padding-bottom: 1.25rem;
}

.view-header-title {
    font-family: var(--font-serif);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.view-title {
    font-family: var(--font-serif);
    font-size: 1.65rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.view-title i {
    color: var(--accent-gold-start);
}

.view-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    border-top: 1px solid rgba(229, 169, 91, 0.08);
    padding-top: 1.5rem;
}

.welcome-card {
    max-width: 550px;
    width: 100%;
    padding: 3rem 2.5rem;
    text-align: center;
    border-color: rgba(229, 169, 91, 0.08);
}

.welcome-icon {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(229, 169, 91, 0.08);
    color: var(--accent-gold-start);
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(229, 169, 91, 0.15);
}

.welcome-card-title {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.welcome-card-text {
    color: var(--text-secondary);
    font-size: 0.975rem;
    line-height: 1.7;
}

.welcome-card-text strong {
    color: var(--accent-gold-start);
    font-weight: 600;
}

/* Responsive sidebar layout */
@media (max-width: 860px) {
    #main-screen.active {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--card-border);
        padding: 1.5rem;
        gap: 1.5rem;
    }
    
    .sidebar-user {
        display: none;
    }
    
    .sidebar-menu {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .sidebar-menu-item {
        flex: 1 1 auto;
        justify-content: center;
        padding: 0.75rem 1rem;
    }
    
    .sidebar-menu-item.menu-item-logout {
        margin-top: 0;
    }
    
    .main-content {
        padding: 1.5rem;
        max-height: none;
    }
    
    .view-card {
        padding: 2rem 1.5rem;
    }
}

/* ==========================================================================
   MODAL OVERLAY & CARD
   ========================================================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(11, 10, 9, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1.5rem;
    transition: opacity var(--transition-fast);
}

.modal-card {
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    background: rgba(20, 18, 16, 0.82);
    backdrop-filter: blur(24px) saturate(120%);
    -webkit-backdrop-filter: blur(24px) saturate(120%);
    border: 1px solid rgba(229, 169, 91, 0.15);
    overflow: hidden;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.75rem 2rem;
    border-bottom: 1px solid rgba(229, 169, 91, 0.1);
}

.modal-title {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-title i {
    color: var(--accent-gold-start);
    font-size: 1.2rem;
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover {
    color: var(--error);
}

.modal-card form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
    scrollbar-width: thin;
    scrollbar-color: rgba(229, 169, 91, 0.25) rgba(11, 10, 9, 0.2);
}

.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: rgba(11, 10, 9, 0.2);
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: rgba(229, 169, 91, 0.25);
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: rgba(229, 169, 91, 0.45);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid rgba(229, 169, 91, 0.1);
    background: rgba(11, 10, 9, 0.4);
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 15px rgba(229, 169, 91, 0.2);
    }
    100% {
        box-shadow: 0 0 30px rgba(229, 169, 91, 0.45);
    }
}

.animate-fade-in {
    animation: fadeIn 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-slide-down {
    animation: slideDown 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-scale-up {
    animation: scaleUp 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleUp {
    from {
        opacity: 0;
        transform: scale(0.92);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==========================================================================
   RESPONSIVENESS
   ========================================================================== */

@media (max-width: 576px) {
    .app-screen {
        padding: 1rem;
    }
    .login-card {
        padding: 2.5rem 1.5rem;
    }
    .brand-title {
        font-size: 1.85rem;
    }
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
        padding: 1rem 0;
    }
    .greeting-title {
        font-size: 1.85rem;
    }
    .btn-settings-trigger {
        width: 100%;
        text-align: center;
    }
    .modal-card {
        max-height: 95vh;
    }
    .modal-body {
        padding: 1.25rem;
    }
    .modal-header, .modal-footer {
        padding: 1.25rem;
    }
}

/* Shake animation for errors */
.shake-effect {
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-6px); }
    20%, 40%, 60%, 80% { transform: translateX(6px); }
}

/* Link Buttons for Navigation */
.btn-link {
    background: transparent;
    border: none;
    color: var(--accent-gold-start);
    font-family: var(--font-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    text-decoration: none;
    transition: all var(--transition-fast);
    display: inline-flex;
    align-items: center;
}

.btn-link:hover {
    color: var(--text-primary);
    text-shadow: 0 0 8px rgba(229, 169, 91, 0.3);
}

.form-footer-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.75rem;
    border-top: 1px solid rgba(229, 169, 91, 0.08);
    padding-top: 1.25rem;
}

.action-text {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* Register Screen (matches login screen) */
#register-screen {
    justify-content: center;
    align-items: center;
}

.register-card {
    width: 100%;
    max-width: 440px;
    padding: 3.5rem 2.5rem;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.register-close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.register-close-btn:hover {
    color: var(--error);
}

/* Loading Spinner for buttons */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: calc(50% - 10px);
    left: calc(50% - 10px);
    border: 3px solid rgba(229, 169, 91, 0.3);
    border-radius: 50%;
    border-top-color: var(--bg-obsidian);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Header actions layout */
.header-actions {
    display: flex;
    gap: 1rem;
}

.btn-logout-trigger {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.18);
    color: #ef4444;
    padding: 0.75rem 1.25rem;
    border-radius: 10px;
    font-size: 0.875rem;
}

.btn-logout-trigger:hover {
    background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    color: #0b0a09;
    border-color: transparent;
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.2);
    transform: translateY(-2px);
}

.btn-logout-trigger:active {
    transform: translateY(0);
}

@media (max-width: 576px) {
    .header-actions {
        width: 100%;
        flex-direction: column;
        gap: 0.75rem;
    }
    .btn-logout-trigger {
        width: 100%;
        text-align: center;
    }
}

/* Custom Autofill Styles to override browser default white/blue background */
input:autofill,
input:autofill:hover,
input:autofill:focus,
textarea:autofill,
textarea:autofill:hover,
textarea:autofill:focus,
input:-webkit-autofill,
input:-webkit-autofill:hover, 
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text-primary) !important;
    color: var(--text-primary) !important;
    -webkit-box-shadow: 0 0 0px 1000px #141210 inset !important;
    box-shadow: 0 0 0px 1000px #141210 inset !important;
    border: 1px solid var(--card-border) !important;
    font-family: var(--font-primary) !important;
    transition: background-color 5000s ease-in-out 0s;
}

input:autofill:focus,
textarea:autofill:focus,
input:-webkit-autofill:focus,
textarea:-webkit-autofill:focus {
    border: 1px solid var(--card-border-focus) !important;
    -webkit-box-shadow: 0 0 0px 1000px #141210 inset, 0 0 12px rgba(229, 169, 91, 0.15) !important;
    box-shadow: 0 0 0px 1000px #141210 inset, 0 0 12px rgba(229, 169, 91, 0.15) !important;
}

/* Readers table inside management modal */
.readers-table tbody tr {
    border-bottom: 1px solid rgba(229, 169, 91, 0.05);
    transition: background-color var(--transition-fast);
}

.readers-table tbody tr:hover {
    background-color: rgba(229, 169, 91, 0.02);
}

.readers-table td {
    padding: 1rem;
    color: var(--text-primary);
    vertical-align: middle;
}

.readers-table td.email-cell {
    color: var(--text-secondary);
}

.readers-table td.address-cell {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-muted);
}

.btn-delete-reader {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.18);
    color: #ef4444;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-delete-reader:hover {
    background: #ef4444;
    color: #0b0a09;
    border-color: transparent;
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
    transform: scale(1.05);
}

.btn-delete-reader:active {
    transform: scale(0.95);
}

/* ==========================================================================
   SETTINGS VIEW WIDTH CONSTRAINT
   ========================================================================== */
#view-settings {
    max-width: 520px;
    width: 100%;
    margin: 0 auto;
}

/* ==========================================================================
   BOOKS GRID & CARD STYLES
   ========================================================================== */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.75rem;
    margin-top: 1.5rem;
    width: 100%;
}

.book-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.book-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-gold-start);
    box-shadow: var(--shadow-glow), var(--shadow-md);
}

.book-card-media {
    position: relative;
    width: 100%;
    aspect-ratio: 2/3;
    overflow: hidden;
    background: rgba(var(--bg-obsidian-rgb), 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: 1px solid rgba(229, 169, 91, 0.08);
}

.book-card-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-smooth);
}

.book-card:hover .book-card-cover {
    transform: scale(1.05);
}

.book-card-cover-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: rgba(229, 169, 91, 0.02);
}

.btn-edit-book {
    position: absolute;
    top: 0.75rem;
    right: 3.25rem;
    background: rgba(229, 169, 91, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--bg-obsidian);
    border: 1px solid rgba(229, 169, 91, 0.2);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-5px);
    transition: all var(--transition-fast);
    z-index: 2;
}

.book-card:hover .btn-edit-book {
    opacity: 1;
    transform: translateY(0);
}

.btn-edit-book:hover {
    background: var(--accent-gradient);
    color: var(--bg-obsidian);
    box-shadow: var(--shadow-glow);
    transform: scale(1.1);
}

.btn-nav-photo {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(20, 18, 16, 0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    color: var(--text-primary);
    border: 1px solid rgba(229, 169, 91, 0.20);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    opacity: 0;
    transition: all var(--transition-fast);
    z-index: 3;
}

.book-card-media:hover .btn-nav-photo {
    opacity: 1;
}

.btn-nav-photo:hover {
    background: var(--accent-gradient);
    color: var(--bg-obsidian);
    border-color: transparent;
    box-shadow: 0 0 10px rgba(229, 169, 91, 0.4);
}

.btn-nav-photo.prev-photo {
    left: 0.5rem;
}

.btn-nav-photo.next-photo {
    right: 0.5rem;
}

.book-detail-badge {
    background: rgba(229, 169, 91, 0.06);
    border: 1px solid rgba(229, 169, 91, 0.15);
    color: var(--accent-gold-start);
    border-radius: 6px;
    padding: 0.2rem 0.5rem;
    font-size: 0.725rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.book-detail-badge.language-badge {
    background: rgba(245, 245, 247, 0.04);
    border: 1px solid rgba(245, 245, 247, 0.08);
    color: var(--text-secondary);
}

.btn-edit-genre {
    background: rgba(229, 169, 91, 0.08);
    border: 1px solid rgba(229, 169, 91, 0.18);
    color: var(--accent-gold-start);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-edit-genre:hover {
    background: var(--accent-gradient);
    color: var(--bg-obsidian);
    border-color: transparent;
    box-shadow: var(--shadow-glow);
    transform: scale(1.05);
}

.btn-edit-genre:active {
    transform: scale(0.95);
}

.btn-delete-book {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(239, 68, 68, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: #fff;
    border: 1px solid rgba(239, 68, 68, 0.2);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-5px);
    transition: all var(--transition-fast);
    z-index: 2;
}

.book-card:hover .btn-delete-book {
    opacity: 1;
    transform: translateY(0);
}

.btn-delete-book:hover {
    background: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
    transform: scale(1.1);
}

.book-card-details {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
}

.book-card-title {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 0.1rem;
}

.book-card-author {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.book-card-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.15rem;
}

.book-card-comments {
    font-size: 0.825rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    border-top: 1px solid rgba(229, 169, 91, 0.05);
    padding-top: 0.5rem;
    font-style: italic;
}

/* ==========================================================================
   PHOTO UPLOADER & PREVIEWS
   ========================================================================== */
.photo-upload-zone {
    border: 2px dashed rgba(229, 169, 91, 0.25) !important;
    background: rgba(229, 169, 91, 0.01);
}

.photo-upload-zone:hover {
    border-color: var(--accent-gold-start) !important;
    background: rgba(229, 169, 91, 0.04) !important;
    box-shadow: 0 0 15px rgba(229, 169, 91, 0.05);
}

.photo-preview-item {
    transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.photo-preview-item:hover {
    transform: scale(1.02);
    border-color: var(--accent-gold-start) !important;
    box-shadow: var(--shadow-md);
}

.btn-delete-photo {
    transition: all var(--transition-fast) !important;
}

.btn-delete-photo:hover {
    background: #ef4444 !important;
    transform: scale(1.1) !important;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.btn-primary-photo-toggle {
    transition: all var(--transition-fast) !important;
}

.btn-primary-photo-toggle:hover {
    transform: scale(1.02);
}

/* Responsive adjustment for forms grid */
@media (max-width: 576px) {
    .form-row {
        grid-template-columns: 1fr !important;
        gap: 0 !important;
    }
}


/* Danger / Warning Button */
.btn-danger {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: var(--error);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.15);
    transform: translateY(-2px);
}

.btn-danger:active {
    transform: translateY(0);
}
