/* CSS Variables */
:root {
    --primary-color: #3b82f6;
    --primary-dark: #1d4ed8;
    --secondary-color: #8b5cf6;
    --accent-color: #06b6d4;
    --text-dark: #1f2937;
    --text-light: #6b7280;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --border-color: #e5e7eb;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 12px;
    --transition: all 0.3s ease;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* App Layout */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

@media (min-width: 1024px) {
    .app-container {
        flex-direction: row;
    }
}

/* Sidebar Styles */
.sidebar {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 10;
    position: relative;
}

@media (min-width: 1024px) {
    .sidebar {
        width: 320px;
        min-width: 320px;
        max-height: 100vh;
        overflow-y: auto;
        position: sticky;
        top: 0;
    }
}

.sidebar-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-align: center;
    color: #dbeafe;
}

.back-link {
    display: block;
    text-align: center;
    font-size: 0.875rem;
    color: #93c5fd;
    text-decoration: none;
    transition: var(--transition);
    padding: 0.5rem 0;
    border-radius: 6px;
}

.back-link:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Fi'il Navigation */
.fiil-nav {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.fiil-item {
    display: block;
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
    font-size: 1.5rem;
    direction: rtl;
    font-family: 'Amiri', serif;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.8);
    background-color: rgba(255, 255, 255, 0.05);
    transition: var(--transition);
    border: 1px solid transparent;
}

.fiil-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.fiil-item.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    font-weight: 700;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.no-fiil {
    text-align: center;
    font-size: 0.875rem;
    color: #fbbf24;
    margin-top: 1rem;
    padding: 1rem;
    background-color: rgba(251, 191, 36, 0.1);
    border-radius: var(--radius);
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 1.5rem;
    background-color: var(--bg-light);
}

@media (min-width: 768px) {
    .main-content {
        padding: 2.5rem;
    }
}

.content-header {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    border-top: 4px solid var(--primary-color);
}

.page-title {
    font-size: 1.875rem;
    font-weight: 800;
    color: var(--text-dark);
    margin-bottom: 1rem;
}

.highlight {
    color: var(--primary-color);
}

.wazan-description {
    color: var(--text-light);
    font-style: italic;
    font-size: 0.95rem;
    margin-top: 0.5rem;
}

/* Arabic Typography */
.arabic-display-large {
    font-family: 'Scheherazade New', serif;
    font-size: 2.5rem;
    line-height: 1.5;
    direction: rtl;
    font-weight: 700;
    color: var(--text-dark);
}

.arabic-display-medium {
    font-family: 'Scheherazade New', serif;
    font-size: 1.8rem;
    line-height: 1.5;
    direction: rtl;
}

/* Tashrif Container */
.tashrif-container {
    background: var(--bg-white);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
}

.tashrif-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
    color: var(--text-dark);
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.tashrif-table {
    width: 100%;
    border-collapse: collapse;
    direction: rtl;
    background: var(--bg-white);
}

.tashrif-table th, 
.tashrif-table td {
    padding: 1rem;
    text-align: center;
    border: 1px solid var(--border-color);
    white-space: nowrap;
}

.tashrif-table th {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    font-weight: 700;
    font-size: 1.25rem;
    font-family: 'Amiri', serif;
    padding: 1.25rem 1rem;
}

.info-row {
    background-color: #f8fafc;
}

.info-cell {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
    direction: ltr;
    font-family: 'Inter', sans-serif;
    padding: 0.75rem 0.5rem;
}

.arabic-cell {
    font-family: 'Amiri', serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    transition: var(--transition);
}

.tashrif-table tbody tr:hover .arabic-cell {
    color: var(--primary-color);
    background-color: #f0f9ff;
}

/* Table Footer */
.table-footer {
    text-align: center;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Alert Styles */
.alert-warning {
    background-color: #fef3c7;
    border-left: 4px solid #f59e0b;
    color: #92400e;
    padding: 1.5rem;
    border-radius: var(--radius);
}

.alert-title {
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* Responsive Adjustments */
@media (max-width: 1024px) {
    .sidebar {
        max-height: 300px;
        margin-bottom: 1rem;
    }
    
    .arabic-display-large {
        font-size: 2rem;
    }
    
    .tashrif-table th, 
    .tashrif-table td {
        font-size: 1.2rem;
        padding: 0.75rem 0.5rem;
    }
    
    .arabic-cell {
        font-size: 1.2rem;
    }
}

@media (max-width: 768px) {
    .content-header {
        padding: 1.5rem;
    }
    
    .tashrif-container {
        padding: 1.5rem;
    }
    
    .page-title {
        font-size: 1.5rem;
    }
    
    .arabic-display-large {
        font-size: 1.75rem;
    }
    
    .tashrif-title {
        font-size: 1.25rem;
    }
}

/* Animation for smooth transitions */
.fiil-item, 
.back-link, 
.arabic-cell {
    transition: var(--transition);
}

/* Custom scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}


.chapter-nav {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 20px rgba(0,0,0,0.1);
}

.nav-container {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.nav-number:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.nav-number.active {
    background: white;
    color: #667eea;
    border-color: #fff;
    box-shadow: 0 0 15px rgba(255,255,255,0.5);
}