/* CSS Reset & Variables */
:root {
    /* Hemam Shababiya Visual Identity Colors */
    --bg-color: #1a4146; /* Deep elegant teal */
    --card-bg: rgba(23, 83, 85, 0.7); /* Glassmorphism background based on dark teal */
    --card-border: rgba(56, 182, 196, 0.2);
    --text-main: #f8fafc;
    --text-muted: #bfebe9;
    
    --primary: #38b6c4; /* Bright Cyan from logo */
    --primary-hover: #2b96a3;
    
    --success: #7ea795; /* Sage green from logo */
    --warning: #f59e0b; /* Yellow */
    --danger: #ef4444; /* Red */
    
    --font-heading: 'Tajawal', sans-serif;
    --font-body: 'Tajawal', sans-serif;
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Background Effects (Glassmorphism blobs) */
.background-elements {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
    opacity: 0.5;
}

.blob-1 {
    top: -10%; right: -10%;
    width: 600px; height: 600px;
    background: radial-gradient(circle, rgba(56,182,196,0.3) 0%, rgba(56,182,196,0) 70%);
}

.blob-2 {
    bottom: -20%; left: -10%;
    width: 700px; height: 700px;
    background: radial-gradient(circle, rgba(126,167,149,0.3) 0%, rgba(126,167,149,0) 70%);
}

.blob-3 {
    top: 40%; left: 40%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(23,83,85,0.4) 0%, rgba(23,83,85,0) 70%);
}

/* Typography & Layout */
.dashboard-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.app-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}

.brand-logo {
    max-height: 100px;
    object-fit: contain;
    margin: 0 auto;
}

.logo {
    font-family: 'Tajawal', sans-serif;
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #38b6c4, #7ea795);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.logo-icon i {
    background: linear-gradient(135deg, #38b6c4, #7ea795);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* General Cards */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card h2 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 1rem;
}

/* Dashboard Content Grid */
.dashboard-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.stats-chart-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

@media (max-width: 900px) {
    .stats-chart-container {
        grid-template-columns: 1fr;
    }
}

/* Forms */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-group input, 
.form-group select,
.filters select {
    width: 100%;
    padding: 0.8rem 1rem;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    background: rgba(26, 65, 70, 0.8);
    color: var(--text-main);
    font-family: var(--font-body);
    outline: none;
    transition: all 0.3s ease;
}

.form-group input:focus, 
.form-group select:focus,
.filters select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(56, 182, 196, 0.3);
}

/* Ensures datepicker icon handles correctly in dark mode */
::-webkit-calendar-picker-indicator {
    filter: invert(1);
    cursor: pointer;
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: left 1rem center;
    background-size: 1em;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.8rem 2rem;
    border-radius: 10px;
    font-family: var(--font-body);
    font-weight: 700;
    cursor: pointer;
    transition: background 0.3s ease, transform 0.2s ease;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-box {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--card-border);
    border-radius: 15px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    font-size: 2.5rem;
}

.text-blue { color: var(--primary); }
.text-green { color: var(--success); }
.text-red { color: var(--danger); }

.stat-details {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
}

.stat-details label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Alerts */
.alerts-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.alert {
    padding: 1rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.95rem;
    border-right: 4px solid var(--warning);
    background: rgba(245, 158, 11, 0.1);
}

.alert i {
    color: var(--warning);
    font-size: 1.2rem;
}

/* Chart Area */
.chart-wrapper {
    position: relative;
    height: 300px;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Table Area */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--card-border);
    margin-bottom: 1.5rem;
}

.table-header h2 {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.filters select {
    width: auto;
    padding-left: 2.5rem;
    cursor: pointer;
}

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

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

.team-table th, .team-table td {
    padding: 1rem;
    text-align: right;
    border-bottom: 1px solid var(--card-border);
}

.team-table th {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
}

.team-table tbody tr {
    transition: background 0.2s ease;
}

.team-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.badge {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.badge.status-progress { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.badge.status-completed { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.badge.status-hold { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }

.badge.priority-high { color: var(--danger); }
.badge.priority-medium { color: var(--warning); }
.badge.priority-low { color: var(--success); }

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.2s ease;
}

.btn-icon:hover {
    color: var(--danger);
}

@media (max-width: 600px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* ===== Admin UI Elements ===== */
.admin-header-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(56, 182, 196, 0.15);
    color: var(--primary);
    padding: 0.5rem 1.2rem;
    border-radius: 50px;
    border: 1px solid rgba(56, 182, 196, 0.3);
    font-size: 0.9rem;
    font-weight: 700;
    margin-top: 1rem;
}

.btn-admin-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 1.4rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-admin-nav:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(56, 182, 196, 0.3);
}

/* ===== Premium Modal System ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 30, 35, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal-card {
    background: linear-gradient(165deg, rgba(23, 83, 85, 0.95), rgba(15, 23, 42, 0.95));
    border: 1px solid rgba(56, 182, 196, 0.3);
    border-radius: 24px;
    padding: 3rem 2rem;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    text-align: center;
    animation: modalScaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalScaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-icon {
    width: 70px;
    height: 70px;
    background: rgba(56, 182, 196, 0.1);
    border: 1px solid rgba(56, 182, 196, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    font-size: 2rem;
    color: var(--primary);
    box-shadow: 0 0 20px rgba(56, 182, 196, 0.1);
}

.modal-card h2 {
    font-size: 1.7rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fff, #bfebe9);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    border: none;
    padding: 0;
}

.modal-card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

#login-error {
    background: rgba(239, 68, 68, 0.1);
    color: #ff6b6b;
    padding: 0.8rem;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-top: 1rem;
    border: 1px solid rgba(239, 68, 68, 0.2);
    display: none;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.modal-footer {
    margin-top: 1.5rem;
}

.link-back {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.link-back:hover {
    color: var(--primary);
}

/* Row Actions in Admin Table */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.btn-icon.edit-btn:hover { color: var(--primary); }
.btn-icon.delete-btn:hover { color: #f87171; }

