/**
 * Alhoshan EstateOS - Professional Frontend Stylesheet
 * Version: 4.0 (Complete Rebuild)
 *
 * This file provides a complete, professional, and conflict-free styling
 * for the entire dashboard, with full dark mode support.
 */

/* =================================================================
   1. CSS VARIABLES (THEME COLORS & SIZES)
   ================================================================= */
:root {
    /* Color Palette */
    --primary-color: #0d2d5d;       /* Dark Blue */
    --secondary-color: #f39c12;     /* Gold/Orange */
    --accent-color: #3e8ef7;        /* Light Blue for links/highlights */
    --success-color: #28a745;       /* Green */
    --danger-color: #dc3545;        /* Red */
    --warning-color: #ffc107;       /* Yellow */

    /* Light Mode */
    --bg-light: #f5f7fa;            /* Main background */
    --card-bg-light: #ffffff;       /* Card/widget background */
    --text-dark: #344767;           /* Main text color */
    --text-muted: #6c757d;          /* Subdued text color */
    --border-color-light: #e9ecef;  /* Border color */

    /* Dark Mode */
    --bg-dark: #111c44;             /* Main background */
    --card-bg-dark: #1a234b;        /* Card/widget background */
    --text-light: #e9ecef;          /* Main text color */
    --text-muted-dark: #8c98b4;     /* Subdued text color */
    --border-color-dark: #2d375d;   /* Border color */

    /* General */
    --sidebar-width: 260px;
    --card-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --card-border-radius: 0.75rem; /* 12px */
    --font-family-base: 'Tahoma', 'Segoe UI', sans-serif;
}

/* =================================================================
   2. GLOBAL & RESET STYLES
   ================================================================= */
body {
    font-family: var(--font-family-base);
    background-color: var(--bg-light);
    color: var(--text-dark);
    margin: 0;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s, color 0.3s;
}

* { box-sizing: border-box; }
h1,h2,h3,h4,h5,h6 { margin-top: 0; margin-bottom: 0.5rem; font-weight: 600; }
p { margin-top: 0; margin-bottom: 1rem; }
a { color: var(--accent-color); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--secondary-color); }

/* =================================================================
   3. LAYOUT & STRUCTURE
   ================================================================= */
#alhoshanos-app-wrapper {
    display: flex;
    direction: rtl;
    min-height: 100vh;
}

#alhoshanos-sidebar {
    width: var(--sidebar-width);
    background-color: var(--primary-color);
    color: #c5d3e7;
    height: 100vh;
    position: fixed;
    top: 0;
    right: 0;
    z-index: 1001;
    display: flex;
    flex-direction: column;
}

#alhoshanos-main-panel {
    width: calc(100% - var(--sidebar-width));
    margin-right: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

#alhoshanos-topbar {
    background: var(--card-bg-light);
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color-light);
    position: sticky;
    top: 0;
    z-index: 1000;
    min-height: 70px;
    border-radius: 12px;
}

#alhoshanos-content-area {
    padding: 2rem;
    flex-grow: 1;
}

/* =================================================================
   4. SIDEBAR STYLES
   ================================================================= */
.sidebar-header {
    text-align: center;
    padding: 1.5rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.sidebar-header .logo { max-height: 90%; width: auto; }
.sidebar-nav { flex-grow: 1; overflow-y: auto; }
.nav-group { margin-bottom: 1rem; }
.nav-title { padding: 0.5rem 1.5rem; font-size: 11px; text-transform: uppercase; color: rgba(255,255,255,0.4); font-weight: bold; }
.sidebar-nav ul { list-style: none; padding: 0; margin: 0; }
.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 25px;
    color: #c5d3e7;
    border-right: 4px solid transparent;
    margin: 3px 0;
    transition: all 0.2s ease-in-out;
}
.nav-link:hover {
    background-color: rgba(255,255,255,0.05);
    color: #fff;
    border-right-color: rgba(243, 156, 18, 0.5);
}
.nav-link.active {
    background-color: rgba(255,255,255,0.1);
    border-right-color: var(--secondary-color);
    color: #fff;
    font-weight: bold;
}
.nav-icon {
    margin-left: 14px;
    font-size: 1.1em;
    width: 22px;
    text-align: center;
    line-height: 1;
}

/* =================================================================
   5. TOPBAR STYLES
   ================================================================= */
.topbar-left, .topbar-right {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
#alhoshanos-sidebar-toggle, #alhoshanos-theme-toggle {
    background: transparent;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
}
.search-bar input {
    border: 1px solid var(--border-color-light);
    border-radius: 6px;
    padding: 8px 12px;
    min-width: 250px;
}
.user-profile .avatar {
    border-radius: 50%;
    border: 2px solid var(--border-color-light);
}

/* =================================================================
   6. CONTENT AREA & COMPONENTS
   ================================================================= */
.content-header {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color-light);
}
.content-header.with-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.content-header h1 { font-size: 24px; margin: 0; }
.content-header p { margin: 4px 0 0; color: var(--text-muted); font-size: 14px; }

/* --- Cards --- */
.card, .alhoshanos-card, .alhoshanos-table-container {
    background: var(--card-bg-light);
    border: 1px solid var(--border-color-light);
    border-radius: var(--card-border-radius);
    box-shadow: var(--card-shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.alhoshanos-stats-cards-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    margin-bottom: 2rem;
}

.alhoshanos-stat-card {
    background-color: white;
    border-radius: 12px;
}

.alhoshanos-stat-card { padding: 1.5rem; text-align: center; }
.alhoshanos-stat-card h3 { margin: 0 0 10px; font-size: 13px; color: var(--text-muted); font-weight: normal; text-transform: uppercase; }
.alhoshanos-stat-card .alhoshanos-card-value { margin: 0; font-size: 26px; font-weight: 600; }
.alhoshanos-dashboard-columns { display: grid; gap: 1.5rem; grid-template-columns: 2fr 1fr; }
.alhoshanos-column h2 { font-size: 18px; margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border-color-light); }

/* --- Tables --- */
.alhoshanos-table-container { padding: 0; }
.alhoshanos-data-table { width: 100%; border-collapse: collapse; }
.alhoshanos-data-table th, .alhoshanos-data-table td {
    padding: 1rem 1.5rem;
    text-align: right;
    border-bottom: 1px solid var(--border-color-light);
    vertical-align: middle;
}
.alhoshanos-data-table thead th {
    background-color: #f8f9fa;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    color: var(--text-muted);
}
.alhoshanos-data-table tbody tr:hover {
    background-color: #fcfdfe;
}

/* --- Forms --- */
.alhoshanos-form-container { padding: 1rem; }
.alhoshanos-form-group { margin-bottom: 1.5rem; }
.alhoshanos-form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    font-size: 14px;
}
.alhoshanos-form-group input,
.alhoshanos-form-group select,
.alhoshanos-form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color-light);
    border-radius: 8px;
    font-size: 14px;
    background-color: var(--card-bg-light);
    color: var(--text-dark);
    transition: all 0.2s ease-in-out;
}
.alhoshanos-form-group input:focus,
.alhoshanos-form-group select:focus,
.alhoshanos-form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 51, 102, 0.1);
}
.alhoshanos-form-actions {
    padding-top: 1.5rem;
    margin-top: 1.5rem;
    border-top: 1px solid var(--border-color-light);
    text-align: left;
}

/* --- Buttons --- */
.alhoshanos-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s ease;
}
.alhoshanos-btn.btn-primary { background-color: var(--primary-color); color: white; }
.alhoshanos-btn.btn-primary:hover { background-color: #0b254a; }
.alhoshanos-btn-link { color: var(--accent-color); font-weight: 600; text-decoration: none; }

/* =================================================================
   7. DARK MODE STYLES
   ================================================================= */
body.dark-mode .card,
body.dark-mode .alhoshanos-table-container,
body.dark-mode #alhoshanos-topbar,
body.dark-mode .alhoshanos-modal-content {
    background-color: var(--card-bg-dark);
    border-color: var(--border-color-dark);
    box-shadow: none;
}
body.dark-mode .content-header,
body.dark-mode .form-actions,
body.dark-mode .alhoshanos-data-table th,
body.dark-mode .alhoshanos-data-table td {
    border-color: var(--border-color-dark);
}
body.dark-mode h1, body.dark-mode h2, body.dark-mode h3, body.dark-mode h4, body.dark-mode h5, body.dark-mode h6,
body.dark-mode .alhoshanos-data-table th,
body.dark-mode .alhoshanos-data-table td strong {
    color: var(--text-light);
}
body.dark-mode p,
body.dark-mode .alhoshanos-data-table td,
body.dark-mode .form-group label {
    color: var(--text-muted-dark);
}
body.dark-mode .alhoshanos-data-table thead th { background-color: #232e54; }
body.dark-mode .alhoshanos-data-table tbody tr:hover { background-color: rgba(255, 255, 255, 0.03); }
body.dark-mode input, body.dark-mode select, body.dark-mode textarea {
    background-color: var(--dark-bg);
    border-color: var(--border-color-dark);
    color: var(--text-light);
}
body.dark-mode input::placeholder, body.dark-mode textarea::placeholder { color: var(--text-muted-dark); }
body.dark-mode .alhoshanos-btn-link { color: #8ab4f8; }
body.dark-mode #alhoshanos-theme-toggle,
body.dark-mode #alhoshanos-sidebar-toggle,
body.dark-mode .alhoshanos-bell-icon { color: var(--text-muted-dark); }