/* ===================================
   Isola Dashboard - Styles
   =================================== */

:root {
    --primary-color: #7CB342;
    --primary-dark: #558B2F;
    --accent-color: #FFA726;
    --bg-color: #F5F5F5;
    --card-bg: #FFFFFF;
    --text-dark: #212121;
    --text-light: #757575;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

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

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

/* ===================================
   Login Screen
   =================================== */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.login-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 100%;
    text-align: center;
    animation: fadeInUp 0.6s ease-out;
}

.login-logo {
    width: 120px;
    height: auto;
    margin-bottom: 20px;
    animation: zoomIn 0.6s ease-out;
}

.login-card h1 {
    color: var(--primary-color);
    margin-bottom: 10px;
    font-size: 28px;
}

.login-card p {
    color: var(--text-light);
    margin-bottom: 30px;
}

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

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

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #E0E0E0;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(124, 179, 66, 0.1);
}

.error-message {
    color: #F44336;
    font-size: 14px;
    margin-top: 10px;
    display: none;
}

.error-message.active {
    display: block;
    animation: shake 0.5s;
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 179, 66, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

/* ===================================
   Dashboard Layout
   =================================== */

.dashboard-container {
    min-height: 100vh;
    background: var(--bg-color);
}

.hidden {
    display: none !important;
}

/* Header */
.dashboard-header {
    background: var(--card-bg);
    padding: 30px 40px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.header-logo {
    width: 60px;
    height: auto;
}

.header-text h1 {
    color: var(--primary-color);
    font-size: 28px;
    margin-bottom: 5px;
}

.header-text p {
    color: var(--text-light);
    font-size: 14px;
}

.header-actions {
    display: flex;
    gap: 15px;
    align-items: center;
}

.btn-complaints {
    padding: 12px 24px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-complaints:hover {
    background: #FB8C00;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 167, 38, 0.4);
}

.btn-logout {
    padding: 12px 24px;
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

/* ===================================
   Tab Navigation
   =================================== */

.tab-navigation {
    background: var(--card-bg);
    padding: 0 40px;
    display: flex;
    gap: 10px;
    border-bottom: 2px solid #F0F0F0;
}

.tab-btn {
    padding: 16px 32px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    color: var(--primary-color);
    background: #F9F9F9;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* ===================================
   Loading State
   =================================== */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #E0E0E0;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Dashboard Content */
.dashboard-content {
    padding: 40px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ===================================
   Statistics Cards
   =================================== */

.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.stat-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    opacity: 0;
}

.stat-card[data-animation="fade-in-up"] {
    animation: fadeInUp 0.6s ease-out forwards;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-card-highlight {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.stat-card-highlight .stat-info h3,
.stat-card-highlight .stat-number {
    color: white;
}

.stat-subtitle {
    display: block;
    font-size: 13px;
    margin-top: 8px;
    opacity: 0.9;
    font-weight: 500;
}

.stat-icon {
    font-size: 48px;
    line-height: 1;
}

.stat-info h3 {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
}

/* ===================================
   Charts Section
   =================================== */

.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 24px;
    margin-bottom: 40px;
}

.chart-card {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    opacity: 0;
}

.chart-card[data-animation="fade-in-up"] {
    animation: fadeInUp 0.6s ease-out forwards;
}

.chart-card h3 {
    margin-bottom: 20px;
    color: var(--text-dark);
    font-size: 18px;
}

.chart-card canvas {
    max-height: 300px;
}

/* ===================================
   Data Table
   =================================== */

.table-section {
    background: var(--card-bg);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    opacity: 0;
}

.table-section[data-animation="fade-in-up"] {
    animation: fadeInUp 0.6s ease-out forwards;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.table-header h3 {
    font-size: 20px;
    color: var(--text-dark);
}

.table-actions {
    display: flex;
    gap: 12px;
}

#searchInput {
    padding: 10px 16px;
    border: 2px solid #E0E0E0;
    border-radius: 8px;
    font-size: 14px;
    min-width: 250px;
    transition: border-color 0.3s ease;
}

#searchInput:focus {
    outline: none;
    border-color: var(--primary-color);
}

.btn-export {
    padding: 10px 20px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-export:hover {
    background: #FB8C00;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 167, 38, 0.4);
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #F5F5F5;
}

th {
    padding: 14px;
    text-align: right;
    font-weight: 600;
    color: var(--text-dark);
    cursor: pointer;
    user-select: none;
    transition: background 0.3s ease;
}

th:hover {
    background: #EEEEEE;
}

tbody tr {
    border-bottom: 1px solid #E0E0E0;
    transition: background 0.3s ease;
}

tbody tr:hover {
    background: #FAFAFA;
}

td {
    padding: 14px;
    text-align: right;
    color: var(--text-dark);
}

/* ===================================
   Status Badges
   =================================== */

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
}

.status-badge.status-occupied {
    background: #7CB342;
    color: white;
}

.status-badge.status-vacant {
    background: #FFA726;
    color: white;
}

/* ===================================
   Priority Badges (Complaints)
   =================================== */

.priority-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 12px;
}

.priority-badge.priority-عاجل {
    background: #F44336;
    color: white;
}

.priority-badge.priority-متوسط {
    background: #FFC107;
    color: #333;
}

.priority-badge.priority-عادي {
    background: #4CAF50;
    color: white;
}

/* ===================================
   Animations
   =================================== */

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(5px);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

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

@media (max-width: 768px) {
    .dashboard-header {
        padding: 16px 20px;
        flex-direction: column;
        gap: 16px;
    }

    .dashboard-content {
        padding: 20px;
    }

    .stats-section {
        grid-template-columns: 1fr;
    }

    .charts-section {
        grid-template-columns: 1fr;
    }

    .table-header {
        flex-direction: column;
        align-items: stretch;
    }

    .table-actions {
        flex-direction: column;
    }

    #searchInput {
        min-width: 100%;
    }

    .header-text h1 {
        font-size: 20px;
    }
}