/* Pastor's Study Bible - CSS Variables and Reset */

/* Load shared theme configuration */
@import url('/study-bible/shared/config/theme.js');

/* CSS Custom Properties - now uses shared theme tokens */
:root {
    /* Colors - Primary */
    --primary-color: #3182ce;
    --primary-hover: #2b77cb;
    --primary-50: #ebf8ff;
    --primary-100: #bee3f8;
    --primary-500: var(--primary-color);
    --primary-600: var(--primary-hover);
    
    /* Colors - Secondary */
    --secondary-color: #2d3748;
    --secondary-light: #4a5568;
    --secondary-50: #f7fafc;
    --secondary-700: var(--secondary-color);
    
    /* Colors - Semantic */
    --success-color: #38a169;
    --success-light: #2f855a;
    --danger-color: #c53030;
    --danger-light: #9b2c2c;
    --warning-color: #f59e0b;
    --info-color: #319795;
    --info-hover: #2c7a7b;
    
    /* Text Colors */
    --text-dark: #333;
    --text-primary: #2c3e50;
    --text-secondary: #6c757d;
    --text-muted: #7f8c8d;
    --text-light: #ecf0f1;
    
    /* Background Colors */
    --bg-body: #f8f9fa;
    --bg-white: #ffffff;
    --bg-light: #f8f9fa;
    --bg-secondary: #e9ecef;
    --bg-dark: #2c3e50;
    
    /* Border Colors */
    --border-light: #e0e6ed;
    --border-medium: #dee2e6;
    --border-dark: #ddd;
    
    /* Border Radius - aligned with theme tokens */
    --border-radius-small: 3px;
    --border-radius: 4px;
    --border-radius-medium: 6px;
    --border-radius-large: 8px;
    --border-radius-xl: 12px;
    --border-radius-2xl: 16px;
    --border-radius-full: 9999px;
    
    /* Shadows - aligned with theme tokens */
    --shadow-none: none;
    --shadow-small: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-base: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-large: 0 4px 8px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-2xl: 0 8px 24px rgba(0, 0, 0, 0.15);
    
    /* Transitions - aligned with theme tokens */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.2s ease;
    --transition-medium: 0.3s ease;
    --transition-slow: 0.5s ease;
    
    /* Spacing - aligned with theme tokens */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 2.5rem;
    --spacing-3xl: 3rem;
    
    /* Font Sizes 
    --font-size-xs: 0.7rem;
    --font-size-sm: 0.8rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.2rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2rem; */
    
    /* Z-Index Hierarchy
     * ==================
     * 1000-1099: Dropdowns and interactive overlays
     * 1020-1099: Sticky and fixed positioning elements
     * 3000-3999: Modal backdrops and base modals
     * 4000-4999: Specialized modals (layered by priority)
     * 5000+:     Tooltips and temporary UI overlays (highest priority)
     */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 3000;
    --z-modal: 3050;
    --z-profile-modal: 4000;
    --z-article-modal: 4100;
    --z-passage-picker-modal: 4200;
    --z-reading-plan-modal: 4300;
    --z-search-help-modal: 4500;
    --z-tooltip: 5000;
}

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

body {
    font-family: 'Georgia', serif;
    line-height: 1.6;
    background-color: var(--bg-body);
    color: var(--text-dark);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Base Typography */
h1, h2, h3, h4, h5, h6 {
    line-height: 1.2;
    margin-bottom: var(--spacing-sm);
}

h1 { font-size: var(--font-size-2xl); }
h2 { font-size: var(--font-size-xl); }
h3 { font-size: var(--font-size-lg); }

p {
    margin-bottom: var(--spacing-md);
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Utility Classes */
.loading {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-secondary);
}

.error {
    color: var(--danger-color);
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    margin: var(--spacing-md);
}

.success {
    color: #155724;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: var(--border-radius);
    padding: var(--spacing-md);
    margin: var(--spacing-md);
}
/* Font Size Customization  */

/* Default font sizes (what you currently have) */
:root {
    --font-size-xs: 0.7rem;
    --font-size-sm: 0.8rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.2rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2rem;
    
    /* Bible reading specific sizes */
    --bible-text-size: 1rem;
    --bible-verse-number-size: 0.8rem;
    --note-text-size: 0.9rem;
    --ui-text-size: 0.9rem;
}

/* Small font size option */
[data-font-size="small"] {
    --font-size-xs: 0.65rem;
    --font-size-sm: 0.75rem;
    --font-size-base: 0.9rem;
    --font-size-lg: 1.1rem;
    --font-size-xl: 1.3rem;
    --font-size-2xl: 1.8rem;
    
    --bible-text-size: 0.9rem;
    --bible-verse-number-size: 0.75rem;
    --note-text-size: 0.85rem;
    --ui-text-size: 0.85rem;
}

/* Default/Medium font size (same as root) */
[data-font-size="medium"] {
    --font-size-xs: 0.7rem;
    --font-size-sm: 0.8rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.2rem;
    --font-size-xl: 1.5rem;
    --font-size-2xl: 2rem;
    
    --bible-text-size: 1rem;
    --bible-verse-number-size: 0.8rem;
    --note-text-size: 0.9rem;
    --ui-text-size: 0.9rem;
}

/* Large font size option */
[data-font-size="large"] {
    --font-size-xs: 0.8rem;
    --font-size-sm: 0.9rem;
    --font-size-base: 1.1rem;
    --font-size-lg: 1.3rem;
    --font-size-xl: 1.6rem;
    --font-size-2xl: 2.2rem;
    
    --bible-text-size: 1.1rem;
    --bible-verse-number-size: 0.9rem;
    --note-text-size: 1rem;
    --ui-text-size: 1rem;
}

/* Extra Large font size option */
[data-font-size="extra-large"] {
    --font-size-xs: 0.9rem;
    --font-size-sm: 1rem;
    --font-size-base: 1.2rem;
    --font-size-lg: 1.4rem;
    --font-size-xl: 1.8rem;
    --font-size-2xl: 2.4rem;
    
    --bible-text-size: 1.2rem;
    --bible-verse-number-size: 1rem;
    --note-text-size: 1.1rem;
    --ui-text-size: 1.1rem;
}

/* Apply font sizes to specific elements */
.bible-content {
    font-size: var(--bible-text-size);
    line-height: 1.7; /* Better readability for larger text */
}

.verse-number {
    font-size: var(--bible-verse-number-size);
}

.note-content {
    font-size: var(--note-text-size);
}

.notes-content {
    font-size: var(--note-text-size);
}

/* UI elements use ui-text-size */
.panel-header,
.notes-header,
.breadcrumb-nav,
.quick-actions {
    font-size: var(--ui-text-size);
}

/* Ensure buttons and forms scale appropriately */
.btn,
.form-group input,
.form-group textarea,
.form-group select {
    font-size: var(--ui-text-size);
}

/* Modal text scaling */
.modal-content {
    font-size: var(--ui-text-size);
}

.profile-tab-content {
    font-size: var(--ui-text-size);
}

/* Responsive adjustments for large fonts */
[data-font-size="large"] .verse,
[data-font-size="extra-large"] .verse {
    margin-bottom: 0.75rem; /* More space between verses for large text */
}

[data-font-size="large"] .note-item,
[data-font-size="extra-large"] .note-item {
    margin-bottom: 1.5rem; /* More space between notes for large text */
    padding: 1.2rem; /* Slightly more padding */
}

/* Mobile adjustments for font scaling */
@media (max-width: 768px) {
    [data-font-size="large"] .bible-content,
    [data-font-size="extra-large"] .bible-content {
        padding: 0.75rem; /* Reduce padding on mobile with large text */
    }

    [data-font-size="extra-large"] {
        --bible-text-size: 1.1rem; /* Cap extra-large on mobile */
        --note-text-size: 1rem;
        --ui-text-size: 0.95rem;
    }
}

/* ==========================================
   Dark Mode Theme
   ========================================== */

/* Dark mode color overrides */
[data-theme="dark"] {
    /* Colors - Primary (slightly brighter for dark mode) */
    --primary-color: #4a9ede;
    --primary-hover: #5aaeee;
    --primary-50: #1a2e3d;
    --primary-100: #1e3a4d;
    --primary-500: var(--primary-color);
    --primary-600: var(--primary-hover);

    /* Colors - Secondary */
    --secondary-color: #a0aec0;
    --secondary-light: #cbd5e0;
    --secondary-50: #2d3748;
    --secondary-700: var(--secondary-color);

    /* Colors - Semantic (adjusted for dark backgrounds) */
    --success-color: #48bb78;
    --success-light: #68d391;
    --danger-color: #fc8181;
    --danger-light: #feb2b2;
    --warning-color: #f6ad55;
    --info-color: #4fd1c5;
    --info-hover: #38b2ac;

    /* Text Colors */
    --text-dark: #e2e8f0;
    --text-primary: #f7fafc;
    --text-secondary: #a0aec0;
    --text-muted: #718096;
    --text-light: #2d3748;

    /* Background Colors */
    --bg-body: #1a202c;
    --bg-white: #2d3748;
    --bg-light: #2d3748;
    --bg-secondary: #4a5568;
    --bg-dark: #171923;

    /* Border Colors */
    --border-light: #4a5568;
    --border-medium: #4a5568;
    --border-dark: #718096;

    /* Shadows (adjusted for dark mode) */
    --shadow-small: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-base: 0 2px 4px rgba(0, 0, 0, 0.4);
    --shadow-medium: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-large: 0 4px 8px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-2xl: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* Dark mode specific element overrides */
[data-theme="dark"] body {
    background-color: var(--bg-body);
    color: var(--text-dark);
}

[data-theme="dark"] .error {
    color: var(--danger-color);
    background: #2d1f1f;
    border-color: #5c3c3c;
}

[data-theme="dark"] .success {
    color: var(--success-color);
    background: #1f2d1f;
    border-color: #3c5c3c;
}

/* Dark mode header */
[data-theme="dark"] header {
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    border-bottom-color: var(--border-light);
}

/* Dark mode panels */
[data-theme="dark"] .panel {
    background-color: var(--bg-white);
    border-color: var(--border-light);
}

[data-theme="dark"] .panel-header {
    background-color: var(--bg-secondary);
    border-bottom-color: var(--border-light);
}

/* Dark mode buttons */
[data-theme="dark"] .btn-secondary {
    background-color: var(--bg-secondary);
    color: var(--text-dark);
    border-color: var(--border-light);
}

[data-theme="dark"] .btn-secondary:hover {
    background-color: #5a6678;
}

/* Dark mode modals */
[data-theme="dark"] .modal-content {
    background-color: var(--bg-white);
    border-color: var(--border-light);
}

[data-theme="dark"] .modal-header {
    background-color: var(--bg-secondary);
    border-bottom-color: var(--border-light);
}

/* Dark mode form inputs */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background-color: var(--bg-body);
    color: var(--text-dark);
    border-color: var(--border-light);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 158, 222, 0.2);
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
    color: var(--text-muted);
}

/* Dark mode Bible content */
[data-theme="dark"] .bible-content {
    background-color: var(--bg-white);
}

[data-theme="dark"] .verse-number {
    color: var(--primary-color);
}

[data-theme="dark"] .verse:hover {
    background-color: var(--bg-secondary);
}

/* Dark mode notes */
[data-theme="dark"] .note-item {
    background-color: var(--bg-body);
    border-color: var(--border-light);
}

[data-theme="dark"] .note-item:hover {
    border-color: var(--primary-color);
}

[data-theme="dark"] .pastor-note {
    background: linear-gradient(135deg, #2d3748 0%, #1a2e3d 100%);
    border-left-color: var(--primary-color);
}

/* Dark mode tabs */
[data-theme="dark"] .profile-tab-btn {
    color: var(--text-secondary);
}

[data-theme="dark"] .profile-tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

[data-theme="dark"] .profile-tab-btn:hover:not(.active) {
    color: var(--text-dark);
    background-color: var(--bg-secondary);
}

/* Dark mode data sections */
[data-theme="dark"] .data-section {
    background-color: var(--bg-body);
    border-color: var(--border-light);
}

/* Dark mode future features */
[data-theme="dark"] .future-feature {
    background: linear-gradient(135deg, #2d3748, #4a5568);
    border-color: var(--border-light);
}

/* Dark mode scrollbar */
[data-theme="dark"] ::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
    background: var(--bg-body);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: var(--bg-secondary);
    border-radius: 5px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #5a6678;
}

/* Dark mode passage picker */
[data-theme="dark"] .passage-picker-modal {
    background-color: var(--bg-white);
}

[data-theme="dark"] .book-category {
    background-color: var(--bg-body);
}

[data-theme="dark"] .book-item {
    background-color: var(--bg-secondary);
    color: var(--text-dark);
}

[data-theme="dark"] .book-item:hover {
    background-color: var(--primary-color);
}

/* Dark mode breadcrumb */
[data-theme="dark"] .breadcrumb-nav {
    background-color: var(--bg-secondary);
}

/* Dark mode search */
[data-theme="dark"] .search-container input {
    background-color: var(--bg-body);
    color: var(--text-dark);
}

/* Dark mode dropdowns */
[data-theme="dark"] .dropdown-menu {
    background-color: var(--bg-white);
    border-color: var(--border-light);
    box-shadow: var(--shadow-xl);
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: var(--bg-secondary);
}

/* Dark mode reading plan */
[data-theme="dark"] .reading-plan-item {
    background-color: var(--bg-body);
    border-color: var(--border-light);
}

[data-theme="dark"] .reading-plan-item.completed {
    background-color: #1f2d1f;
}

/* Dark mode tables */
[data-theme="dark"] table {
    background-color: var(--bg-white);
}

[data-theme="dark"] th {
    background-color: var(--bg-secondary);
    color: var(--text-dark);
}

[data-theme="dark"] td {
    border-color: var(--border-light);
}

[data-theme="dark"] tr:hover {
    background-color: var(--bg-secondary);
}

/* System preference detection - auto dark mode */
@media (prefers-color-scheme: dark) {
    [data-theme="auto"] {
        /* Colors - Primary (slightly brighter for dark mode) */
        --primary-color: #4a9ede;
        --primary-hover: #5aaeee;
        --primary-50: #1a2e3d;
        --primary-100: #1e3a4d;
        --primary-500: var(--primary-color);
        --primary-600: var(--primary-hover);

        /* Colors - Secondary */
        --secondary-color: #a0aec0;
        --secondary-light: #cbd5e0;
        --secondary-50: #2d3748;
        --secondary-700: var(--secondary-color);

        /* Colors - Semantic */
        --success-color: #48bb78;
        --success-light: #68d391;
        --danger-color: #fc8181;
        --danger-light: #feb2b2;
        --warning-color: #f6ad55;
        --info-color: #4fd1c5;
        --info-hover: #38b2ac;

        /* Text Colors */
        --text-dark: #e2e8f0;
        --text-primary: #f7fafc;
        --text-secondary: #a0aec0;
        --text-muted: #718096;
        --text-light: #2d3748;

        /* Background Colors */
        --bg-body: #1a202c;
        --bg-white: #2d3748;
        --bg-light: #2d3748;
        --bg-secondary: #4a5568;
        --bg-dark: #171923;

        /* Border Colors */
        --border-light: #4a5568;
        --border-medium: #4a5568;
        --border-dark: #718096;

        /* Shadows */
        --shadow-small: 0 1px 2px rgba(0, 0, 0, 0.3);
        --shadow-base: 0 2px 4px rgba(0, 0, 0, 0.4);
        --shadow-medium: 0 2px 8px rgba(0, 0, 0, 0.4);
        --shadow-large: 0 4px 8px rgba(0, 0, 0, 0.4);
        --shadow-xl: 0 4px 12px rgba(0, 0, 0, 0.5);
        --shadow-2xl: 0 8px 24px rgba(0, 0, 0, 0.5);
    }
}