/* assets/style.css */
:root {
    --primary: #2c3e50;
    --secondary: #34495e;
    --accent: #3498db;
    --success: #27ae60;
    --danger: #e74c3c;
    --bg-main: #f8f9fa;
    --bg-card: #ffffff;
    --bg-light: #f0f0f0;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --border-color: #dee2e6;
    --white: #ffffff;
    --sidebar-bg: #2c3e50;
    --sidebar-text: rgba(255,255,255,0.8);
    --sidebar-hover: #34495e;
    --sidebar-width: 260px;
    --transition-speed: 0.3s;
    --shadow: 0 2px 10px rgba(0,0,0,0.05);
}

body.dark-theme {
    --bg-main: #1a1a1a;
    --bg-card: #2d2d2d;
    --bg-light: #3a3a3a;
    --text-primary: #f8f9fa;
    --text-secondary: #adb5bd;
    --border-color: #404040;
    --primary: #34495e;
    --sidebar-bg: #121212;
    --sidebar-hover: #1f1f1f;
    --shadow: 0 4px 15px rgba(0,0,0,0.3);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

[dir="rtl"] body { direction: rtl; }
[dir="ltr"] body { direction: ltr; }

/* Login Page Styles */
.login-container {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--bg-main);
}

.login-card {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card h1 {
    color: var(--accent);
    margin-bottom: 30px;
    font-size: 2rem;
}

.form-group {
    margin-bottom: 20px;
}

[dir="rtl"] .form-group { text-align: right; }
[dir="ltr"] .form-group { text-align: left; }

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background-color: var(--bg-card);
    color: var(--text-primary);
    transition: border-color 0.3s;
}

.form-control:focus {
    border-color: var(--accent);
    outline: none;
}

.btn {
    padding: 12px 24px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition-speed);
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px; /* Mobile touch target */
}

.btn-primary {
    background-color: var(--accent);
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
}

/* Layout Styles */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: white;
    position: fixed;
    height: 100vh;
    top: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-speed);
    overflow-y: auto;
}

/* LTR: Sidebar on left */
[dir="ltr"] .sidebar {
    left: 0;
    right: auto;
}

/* RTL: Sidebar on right */
[dir="rtl"] .sidebar {
    right: 0;
    left: auto;
}

.sidebar-header {
    padding: 30px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    color: var(--sidebar-text);
    text-decoration: none;
    transition: var(--transition-speed);
}

.nav-link:hover, .nav-link.active {
    background-color: var(--sidebar-hover);
    color: white;
}

.nav-link i {
    width: 20px;
    text-align: center;
}

[dir="rtl"] .nav-link i { margin-left: 15px; }
[dir="ltr"] .nav-link i { margin-right: 15px; }

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background-color: var(--bg-main);
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
}

/* LTR: Content offset from left */
[dir="ltr"] .main-content {
    margin-left: var(--sidebar-width);
    margin-right: 0;
}

/* RTL: Content offset from right */
[dir="rtl"] .main-content {
    margin-right: var(--sidebar-width);
    margin-left: 0;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
}

.card {
    background: var(--bg-card);
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow);
    animation: slideIn 0.4s ease-out;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

/* Table Enhancements */
.table-container {
    width: 100%;
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-card);
}

th, td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    text-align: inherit;
}

th {
    background-color: rgba(0,0,0,0.02);
    font-weight: 600;
}

.dark-theme th {
    background-color: rgba(255,255,255,0.05);
}

/* Animations (Python Parity) */
@keyframes slideIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-fade {
    animation: fadeIn 0.5s ease-in;
}

@keyframes zoomIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.animate-zoom {
    animation: zoomIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Theme Toggle Button Style */
.theme-toggle {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    transition: 0.3s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-toggle:hover {
    background: rgba(255,255,255,0.2);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .app-wrapper { 
        flex-direction: column; 
        min-height: 100vh; 
    }
    
    /* Mobile Top Bar */
    .mobile-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0 15px;
        background-color: var(--sidebar-bg);
        color: white;
        z-index: 1001;
        box-shadow: 0 2px 5px rgba(0,0,0,0.2);
        height: 60px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
    }
    
    .hamburger {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;
        width: 30px;
        height: 30px;
        cursor: pointer;
    }
    
    .hamburger div {
        width: 100%;
        height: 2px;
        background-color: white;
        transition: 0.3s;
    }

    /* Sidebar as Mobile Menu */
    .sidebar {
        position: fixed;
        top: 0;
        width: 280px;
        height: 100%;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 2000;
        visibility: hidden;
    }

    [dir="rtl"] .sidebar { 
        transform: translateX(100%); 
        right: 0; 
        left: auto;
        box-shadow: -5px 0 15px rgba(0,0,0,0.2); 
    }
    [dir="ltr"] .sidebar { 
        transform: translateX(-100%); 
        left: 0; 
        box-shadow: 5px 0 15px rgba(0,0,0,0.2); 
    }
    
    .sidebar.open {
        transform: translateX(0);
        visibility: visible;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0,0,0,0.6);
        backdrop-filter: blur(2px);
        z-index: 1999;
    }
    
    .sidebar-overlay.active {
        display: block;
    }

    .main-content { 
        padding: 0 15px 20px; 
        padding-top: 80px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100%; 
        overflow-x: hidden; 
        position: relative;
    }
    
    /* Prevent first child margin collapse */
    .main-content > *:first-child {
        margin-top: 0 !important;
    }
    
    /* Global Component Adjustments */
    .page-header { 
        flex-direction: column; 
        align-items: stretch; 
        gap: 15px;
        margin-top: 0;
        padding-top: 0;
    }
    .page-header .btn-group { display: flex; flex-wrap: wrap; gap: 10px; }
    .page-header .btn-group .btn { flex: 1; min-width: 120px; }
    
    .card { padding: 15px; }
    
    /* Touch Target Optimization */
    .btn, .nav-link, select, input {
        min-height: 48px;
    }

    /* Hamburger Animation */
    .hamburger.active .line1 { transform: rotate(45deg) translate(5px, 5px); }
    .hamburger.active .line2 { opacity: 0; }
    .hamburger.active .line3 { transform: rotate(-45deg) translate(5px, -5px); }
}

@media (min-width: 769px) {
    .mobile-header { display: none; }
    .sidebar-overlay { display: none; }
}
