/**
 * Main Stylesheet
 * Responsive design with Arabic and English support
 */

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

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
    --border-color: #bdc3c7;
    --text-color: #2c3e50;
    --text-light: #7f8c8d;
    --sidebar-width: 250px;
    --header-height: 60px;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    color: var(--text-color);
    line-height: 1.6;
}

/* RTL Support for Arabic */
html[lang="ar"] {
    direction: rtl;
    text-align: right;
}

html[lang="ar"] body {
    font-family: 'Segoe UI', 'Traditional Arabic', Tahoma, Geneva, Verdana, sans-serif;
}

html[lang="en"] {
    direction: ltr;
    text-align: left;
}

/* ========================
   Header Styles
   ======================== */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 0 20px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.header-brand {
    font-size: 1.2rem;
    font-weight: bold;
    text-decoration: none;
    color: white;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-info .username {
    font-weight: 500;
}

.user-info .role {
    font-size: 0.85rem;
    color: #bdc3c7;
}

.language-switcher {
    display: flex;
    gap: 5px;
}

.language-switcher a {
    color: white;
    text-decoration: none;
    padding: 5px 10px;
    border-radius: 3px;
    transition: background-color 0.3s;
}

.language-switcher a:hover,
.language-switcher a.active {
    background-color: rgba(255, 255, 255, 0.2);
}

.logout-btn {
    background-color: var(--danger-color);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 3px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.3s;
}

.logout-btn:hover {
    background-color: #c0392b;
}

/* ========================
   Sidebar Styles
   ======================== */
.container {
    display: flex;
    margin-top: var(--header-height);
    min-height: calc(100vh - var(--header-height));
}

.sidebar {
    width: var(--sidebar-width);
    background-color: var(--primary-color);
    color: white;
    padding: 20px 0;
    position: fixed;
    height: calc(100vh - var(--header-height));
    top: var(--header-height);
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    z-index: 50;
}

html[lang="en"] .sidebar {
    left: 0;
}

html[lang="ar"] .sidebar {
    right: 0;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin: 0;
}

.sidebar-menu a {
    display: block;
    padding: 12px 20px;
    color: #ecf0f1;
    text-decoration: none;
    transition: all 0.3s;
    border-left: 4px solid transparent;
}

html[lang="ar"] .sidebar-menu a {
    border-left: none;
    border-right: 4px solid transparent;
}

.sidebar-menu a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    padding-left: 25px;
    color: white;
}

html[lang="ar"] .sidebar-menu a:hover {
    padding-left: 20px;
    padding-right: 25px;
}

.sidebar-menu a.active {
    background-color: var(--secondary-color);
    border-left-color: white;
    color: white;
}

html[lang="ar"] .sidebar-menu a.active {
    border-left-color: transparent;
    border-right-color: white;
}

.sidebar-menu a i {
    margin-right: 10px;
}

html[lang="ar"] .sidebar-menu a i {
    margin-right: 0;
    margin-left: 10px;
}

/* Menu Dividers & Sections */
.sidebar-menu .menu-item-main a {
    background-color: rgba(255, 255, 255, 0.05);
    font-weight: bold;
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 10px;
}

.sidebar-menu .menu-item-main a:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.sidebar-menu .menu-divider {
    padding: 12px 20px;
    margin-top: 10px;
    margin-bottom: 5px;
    font-size: 0.85rem;
    font-weight: 600;
    color: #bdc3c7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    list-style: none;
}

/* ========================
   Main Content Styles
   ======================== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 20px;
    width: calc(100% - var(--sidebar-width));
}

html[lang="ar"] .main-content {
    margin-left: 0;
    margin-right: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
}

.page-heading {
    background-color: white;
    padding: 20px;
    margin-bottom: 20px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.page-heading h1 {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.page-heading p {
    color: var(--text-light);
}

/* ========================
   Form Styles
   ======================== */
.form-container {
    background-color: white;
    padding: 40px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    max-width: 500px;
    margin: 50px auto;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-color);
}

input[type="text"],
input[type="password"],
input[type="email"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 3px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 5px rgba(52, 152, 219, 0.3);
}

input[type="checkbox"],
input[type="radio"] {
    margin-right: 8px;
    cursor: pointer;
}

html[lang="ar"] input[type="checkbox"],
html[lang="ar"] input[type="radio"] {
    margin-right: 0;
    margin-left: 8px;
}

.checkbox-label,
.radio-label {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    margin-bottom: 10px;
}

/* ========================
   Button Styles
   ======================== */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 3px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
    font-weight: 500;
}

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

.btn-primary:hover {
    background-color: #2980b9;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #229954;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background-color: #e67e22;
}

.btn-block {
    width: 100%;
    display: block;
    text-align: center;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 0.85rem;
}

.btn-info {
    background-color: #17a2b8;
    color: white;
}

.btn-info:hover {
    background-color: #138496;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* ========================
   Alert Styles
   ======================== */
.alert {
    padding: 15px 20px;
    margin-bottom: 20px;
    border-radius: 3px;
    border-left: 4px solid;
}

html[lang="ar"] .alert {
    border-left: none;
    border-right: 4px solid;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-color: #27ae60;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #e74c3c;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border-color: #f39c12;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-color: #3498db;
}

.alert-close {
    float: right;
    cursor: pointer;
    font-weight: bold;
}

html[lang="ar"] .alert-close {
    float: left;
}

/* ========================
   Card Styles
   ======================== */
.card {
    background-color: white;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-bottom: 20px;
}

.card-header {
    background-color: var(--primary-color);
    color: white;
    padding: 15px 20px;
    font-weight: 500;
}

.card-body {
    padding: 20px;
}

.card-footer {
    background-color: #f5f5f5;
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
}

/* ========================
   Table Styles
   ======================== */
.table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    margin-bottom: 20px;
    border-radius: 3px;
    overflow: hidden;
}

.table thead {
    background-color: var(--primary-color);
    color: white;
}

.table th {
    padding: 15px;
    text-align: left;
    font-weight: 500;
}

html[lang="ar"] .table th {
    text-align: right;
}

.table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background-color: #f9f9f9;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ========================
   Dashboard Stats
   ======================== */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-top: 4px solid var(--secondary-color);
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--secondary-color);
}

.stat-label {
    color: var(--text-light);
    margin-top: 5px;
}

/* ========================
   Responsive Design
   ======================== */
@media (max-width: 768px) {
    :root {
        --sidebar-width: 200px;
    }

    .form-container {
        padding: 20px;
        margin: 20px;
        max-width: 100%;
    }

    .sidebar {
        width: var(--sidebar-width);
        transition: left 0.3s, right 0.3s;
    }

    html[lang="en"] .sidebar {
        left: -var(--sidebar-width);
    }

    html[lang="ar"] .sidebar {
        right: -var(--sidebar-width);
    }

    html[lang="en"] .sidebar.active {
        left: 0;
    }

    html[lang="ar"] .sidebar.active {
        right: 0;
    }

    .main-content {
        width: 100%;
        margin-left: 0;
        margin-right: 0;
    }

    html[lang="ar"] .main-content {
        margin-right: 0;
    }

    .page-heading h1 {
        font-size: 1.4rem;
    }

    .stats-container {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

@media (max-width: 480px) {
    html {
        font-size: 14px;
    }

    header {
        padding: 0 10px;
    }

    .header-brand {
        font-size: 1rem;
    }

    .main-content {
        padding: 10px;
    }

    .form-container {
        padding: 15px;
        margin: 10px;
    }

    .page-heading {
        padding: 15px;
    }

    .page-heading h1 {
        font-size: 1.2rem;
    }

    .sidebar-menu a {
        padding: 10px 15px;
        font-size: 0.9rem;
    }
}

/* ========================
   Utility Classes
   ======================== */
.text-center {
    text-align: center;
}

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

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

html[lang="ar"] .text-left {
    text-align: right;
}

html[lang="ar"] .text-right {
    text-align: left;
}

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }
.p-10 { padding: 10px; }
.p-20 { padding: 20px; }
.p-30 { padding: 30px; }

.d-flex {
    display: flex;
}

.gap-10 {
    gap: 10px;
}

.gap-20 {
    gap: 20px;
}

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

.justify-content-between {
    justify-content: space-between;
}

.hidden {
    display: none;
}

.text-muted {
    color: var(--text-light);
}

.text-danger {
    color: var(--danger-color);
}

.text-success {
    color: var(--success-color);
}

.text-warning {
    color: var(--warning-color);
}

/* ========================
   Modal Styles
   ======================== */
.modal {
    display: flex !important;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    background-color: white;
    border-radius: 5px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.modal-header {
    background-color: var(--primary-color);
    color: white;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.3rem;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.modal-close:hover {
    opacity: 0.8;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999;
}

.modal-overlay.hidden {
    display: none;
}

.modal-body {
    padding: 20px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ========================
   Status Badges
   ======================== */
.badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.badge-primary {
    background-color: var(--secondary-color);
    color: white;
}

.badge-success {
    background-color: var(--success-color);
    color: white;
}

.badge-danger {
    background-color: var(--danger-color);
    color: white;
}

.badge-warning {
    background-color: var(--warning-color);
    color: white;
}

.badge-info {
    background-color: #17a2b8;
    color: white;
}
