/**
 * Tanach Common Styles - Design System
 * Version: 2.0.0
 * Last Updated: November 26, 2025
 *
 * Shared styles for all Tanach project pages
 * Provides consistent theming, typography, and responsive design
 *
 * IMPORTANT: This file defines the design system for the entire project.
 * DO NOT override these values in individual page styles without updating this file.
 */

/* ===================================================================
   Design Tokens - MANDATORY: Do Not Override in Individual Files
   ================================================================ */

:root {
    /* ========== Spacing System ========== */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 20px;
    --spacing-xl: 32px;
    --spacing-xxl: 48px;

    /* ========== Typography ========== */
    --font-family-hebrew: 'SBL Hebrew', 'Ezra SIL', serif;
    --font-family-latin: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;

    --font-size-xs: 0.75rem;      /* 12px */
    --font-size-sm: 0.875rem;     /* 14px */
    --font-size-base: 1rem;       /* 16px */
    --font-size-lg: 1.125rem;     /* 18px */
    --font-size-xl: 1.25rem;      /* 20px */
    --font-size-2xl: 1.5rem;      /* 24px */
    --font-size-3xl: 1.75rem;     /* 28px */
    --font-size-4xl: 2rem;        /* 32px */
    --font-size-5xl: 2.5rem;      /* 40px */

    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;
    --line-height-loose: 2;

    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* ========== Layout ========== */
    --max-content-width: 1200px;
    --header-height: 60px;
    --footer-height: 40px;
    --sidebar-width: 250px;

    --border-radius-sm: 4px;
    --border-radius-md: 6px;
    --border-radius-lg: 8px;
    --border-radius-xl: 10px;
    --border-radius-round: 50%;

    /* ========== Component Positions - MANDATORY ========== */
    /* Theme Toggle (Bottom Left) */
    --theme-toggle-bottom: 20px;
    --theme-toggle-left: 20px;
    --theme-toggle-z-index: 1000;
    --theme-toggle-button-size: 45px;

    /* Settings/Options Buttons (Top Left) */
    --settings-button-top: 20px;
    --settings-button-left: 20px;
    --settings-button-z-index: 1001;  /* Above theme toggle */

    /* ========== Z-Index Layers ========== */
    --z-base: 1;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 500;
    --z-modal-backdrop: 900;
    --z-modal: 1000;
    --z-popover: 1100;
    --z-tooltip: 1200;

    /* ========== Transitions ========== */
    --transition-fast: 0.1s ease;
    --transition-base: 0.2s ease;
    --transition-slow: 0.3s ease;
    --transition-very-slow: 0.5s ease;

    /* ========== Shadows ========== */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 8px 16px rgba(0, 0, 0, 0.2);
    --shadow-theme-toggle: 0 2px 10px rgba(0, 0, 0, 0.2);

    /* ========== Light Theme Colors ========== */
    --base-bg: #ffffff;
    --base-text: #333333;
    --secondary-bg: #f8f9fa;
    --tertiary-bg: #e9ecef;
    --border-color: #dee2e6;
    --accent-color: #0d6efd;
    --accent-hover: #0b5ed7;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --link-color: #0d6efd;
    --link-hover: #0a58ca;
    --muted-color: #6c757d;

    /* Hebrew Text Colors */
    --hebrew-text-color: #333333;
    --hebrew-heading-color: #0d6efd;
}

/* ========== Dark Theme Override ========== */
:root[data-theme="dark"] {
    --base-bg: #212529;
    --base-text: #f8f9fa;
    --secondary-bg: #343a40;
    --tertiary-bg: #495057;
    --border-color: #495057;
    --accent-color: #0d6efd;
    --accent-hover: #3d8bfd;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --link-color: #6ea8fe;
    --link-hover: #9ec5fe;
    --muted-color: #adb5bd;

    /* Hebrew Text Colors - Dark Mode */
    --hebrew-text-color: #f8f9fa;
    --hebrew-heading-color: #6ea8fe;

    /* Shadows - Darker for dark mode */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 8px 16px rgba(0, 0, 0, 0.6);
    --shadow-theme-toggle: 0 2px 10px rgba(0, 0, 0, 0.5);
}

/* ===================================================================
   Base Styles
   ================================================================ */

body {
    font-family: 'SBL Hebrew', 'Ezra SIL', serif;
    background-color: var(--base-bg);
    color: var(--base-text);
    transition: background-color 0.3s ease, color 0.3s ease;
    margin: 0;
    padding: 20px;
    direction: rtl;
    line-height: 1.6;
}

/* ===================================================================
   Typography
   ================================================================ */

h1, h2, h3, h4, h5, h6 {
    font-family: 'SBL Hebrew', 'Ezra SIL', serif;
    color: var(--base-text);
    margin-bottom: 1rem;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

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

/* ===================================================================
   Containers & Cards
   ================================================================ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.card {
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.card-header {
    font-size: 1.25rem;
    font-weight: bold;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

/* ===================================================================
   Tables
   ================================================================ */

.tanach-table {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    border: 1.5px solid var(--border-color);
    border-collapse: collapse;
    background-color: var(--base-bg);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
}

.tanach-table td {
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    text-align: center;
    transition: background-color 0.2s ease;
}

.tanach-table td:hover {
    background-color: var(--tertiary-bg);
}

.tanach-table .header {
    font-weight: bold;
    font-size: 1.1rem;
    background-color: var(--secondary-bg);
    padding: 15px;
}

.tanach-table a {
    color: var(--link-color);
    text-decoration: none;
    font-size: 1rem;
    display: block;
    padding: 5px;
    transition: color 0.2s ease;
}

.tanach-table a:hover {
    color: var(--accent-hover);
    text-decoration: none;
}

/* ===================================================================
   Buttons
   ================================================================ */

.btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

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

.btn-secondary {
    background-color: var(--secondary-bg);
    color: var(--base-text);
    border-color: var(--border-color);
}

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

/* ===================================================================
   Theme Toggle - MANDATORY: Do Not Modify Position
   ================================================================ */

/* Position and container styling - MUST NOT BE OVERRIDDEN */
#theme-toggle {
    position: fixed !important;
    bottom: var(--theme-toggle-bottom) !important;
    left: var(--theme-toggle-left) !important;
    z-index: var(--theme-toggle-z-index) !important;
    box-shadow: var(--shadow-theme-toggle) !important;
}

#theme-toggle button {
    width: var(--theme-toggle-button-size);
    height: var(--theme-toggle-button-size);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-color);
    background-color: var(--base-bg);
    color: var(--base-text);
    transition: all var(--transition-base);
}

#theme-toggle button i {
    font-size: var(--font-size-xl);
}

#theme-toggle button.active {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

#theme-toggle button:hover {
    transform: scale(1.05);
    transition: transform var(--transition-base);
}

/* ===================================================================
   Navigation & Links
   ================================================================ */

.intro {
    text-align: center;
    margin: 20px 0 40px;
    line-height: 1.8;
}

.intro p {
    font-size: 1.1rem;
    margin-bottom: 10px;
}

.tools-link {
    text-align: center;
    margin-top: 40px;
    margin-bottom: 20px;
}

.tools-link a {
    font-size: 1.2rem;
    font-weight: 500;
    padding: 12px 30px;
    background-color: var(--accent-color);
    color: white;
    border-radius: 8px;
    display: inline-block;
    transition: all 0.2s ease;
}

.tools-link a:hover {
    background-color: var(--accent-hover);
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* ===================================================================
   Page Header
   ================================================================ */

.page-header {
    text-align: center;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.page-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: var(--accent-color);
}

.page-header .subtitle {
    font-size: 1.2rem;
    color: var(--base-text);
    opacity: 0.8;
}

/* ===================================================================
   Responsive Design
   ================================================================ */

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }

    .page-header h1 {
        font-size: 2rem;
    }

    .tanach-table {
        font-size: 0.9rem;
    }

    .tanach-table td {
        padding: 8px 10px;
    }

    .tanach-table .header {
        font-size: 1rem;
        padding: 10px;
    }

    .tanach-table a {
        font-size: 0.9rem;
    }

    #theme-toggle button {
        width: 45px;
        height: 45px;
    }

    #theme-toggle button i {
        font-size: 1.1rem;
    }

    .card {
        padding: 15px;
    }

    .intro p {
        font-size: 1rem;
    }

    .tools-link a {
        font-size: 1.1rem;
        padding: 10px 25px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 5px;
    }

    .tanach-table {
        font-size: 0.8rem;
    }

    .tanach-table td {
        padding: 6px 8px;
    }

    .tanach-table a {
        font-size: 0.8rem;
        padding: 3px;
    }

    .page-header h1 {
        font-size: 1.75rem;
    }

    .card {
        padding: 10px;
        margin-bottom: 15px;
    }
}

/* ===================================================================
   Loading & Error States
   ================================================================ */

.loading {
    text-align: center;
    padding: 40px;
    color: var(--base-text);
    opacity: 0.6;
    font-size: 1.1rem;
}

.error {
    color: var(--danger-color);
    text-align: center;
    padding: 20px;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 8px;
    margin: 20px 0;
}

:root[data-theme="dark"] .error {
    background-color: #4a0000;
    border-color: #6a0000;
    color: #ff6b6b;
}

/* ===================================================================
   Utility Classes
   ================================================================ */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }
