/* Avana Care Shift - Main Stylesheet
   Developed by Endy Edeson */

:root {
    --navy: #1a2744;
    --navy-light: #243358;
    --navy-dark: #0f1a2e;
    --sky: #3498db;
    --sky-light: #5faee3;
    --sky-dark: #2980b9;
    --green: #2ecc71;
    --green-light: #58d68d;
    --green-dark: #27ae60;
    --red: #e74c3c;
    --red-dark: #c0392b;
    --orange: #e67e22;
    --purple: #8e44ad;
    --bg: #f4f6f9;
    --white: #ffffff;
    --text: #2c3e50;
    --text-light: #7f8c8d;
    --text-muted: #95a5a6;
    --border: #e0e4e8;
    --shadow: 0 2px 12px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 20px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --sidebar-width: 260px;
    --header-height: 64px;
    --transition: all 0.3s ease;
    --font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    line-height: 1.6;
}

/* Auth Pages */
.auth-page {
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 50%, var(--sky-dark) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    overflow: hidden;
}

.auth-wrapper {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px;
}

.auth-container {
    background: var(--white);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.auth-main {
    min-height: 600px;
}

.auth-hero {
    background: linear-gradient(160deg, var(--navy) 0%, var(--navy-light) 50%, var(--sky-dark) 100%);
    padding: 48px;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.auth-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.03) 0%, transparent 70%);
    pointer-events: none;
}

.auth-hero::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -30%;
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, rgba(52,152,219,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.auth-hero-content {
    position: relative;
    z-index: 1;
    width: 100%;
}

.auth-hero-icon {
    text-align: left;
}

.auth-features .auth-feature-item {
    color: rgba(255,255,255,0.8);
    font-size: 0.85rem;
    padding: 6px 0;
    display: flex;
    align-items: center;
}

.auth-form-col {
    padding: 0;
}

.auth-form-container {
    padding: 48px 40px;
    max-width: 420px;
    margin: 0 auto;
}

.auth-form-header .auth-logo img {
    background: rgba(26,39,68,0.05);
    padding: 10px;
    border-radius: 16px;
}

.auth-card .card {
    border: none;
    border-radius: var(--radius);
    box-shadow: none;
}

.auth-logo {
    color: var(--sky) !important;
}

.auth-header h1 {
    color: var(--white);
    font-weight: 700;
}

.auth-header p {
    color: rgba(255,255,255,0.7) !important;
}

@media (max-width: 991.98px) {
    .auth-container { border-radius: 16px; }
    .auth-form-container { padding: 32px 24px; }
    .auth-wrapper { padding: 16px; }
}

/* App Layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--navy);
    color: var(--white);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
}

.sidebar-header {
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand {
    color: var(--white);
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand i {
    color: var(--sky);
    font-size: 1.5rem;
}

.sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.sidebar-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-section {
    padding: 16px 20px 6px;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    color: rgba(255,255,255,0.35);
    font-weight: 700;
}

.nav-item { padding: 1px 10px; }

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    border-radius: 10px;
    transition: var(--transition);
    font-size: 0.88rem;
    font-weight: 500;
}

.nav-link i { 
    width: 20px; 
    text-align: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: var(--white);
}

.nav-link.active {
    background: var(--sky);
    color: var(--white);
    font-weight: 600;
}

.nav-link .badge {
    font-size: 0.7rem;
    padding: 2px 8px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: rgba(255,255,255,0.1);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: var(--transition);
}

/* Header */
.app-header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 1030;
}

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

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

.header-search .input-group {
    min-width: 320px;
}

.header-search .form-control:focus {
    box-shadow: none;
    border-color: var(--sky);
}

.notif-dropdown { 
    max-height: 400px; 
    overflow-y: auto; 
}

.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
    cursor: pointer;
}

.notif-item:hover { background: var(--bg); }

.notif-item.unread { background: #ebf5fb; }

.notif-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

/* Content */
.content-wrapper {
    flex: 1;
    padding: 24px;
}

@media (max-width: 767.98px) {
    .content-wrapper {
        padding: 16px;
    }
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--navy);
    margin: 0;
}

/* Cards */
.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card-header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    padding: 18px 24px;
    font-weight: 600;
    font-size: 0.95rem;
}

.card-body {
    padding: 24px;
}

.card-footer {
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 14px 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

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

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-icon.blue { background: #ebf5fb; color: var(--sky); }
.stat-icon.green { background: #eafaf1; color: var(--green); }
.stat-icon.navy { background: #e8ecf1; color: var(--navy); }
.stat-icon.orange { background: #fef5e7; color: var(--orange); }
.stat-icon.red { background: #fdedec; color: var(--red); }
.stat-icon.purple { background: #f4ecf7; color: var(--purple); }

.stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 4px;
    font-weight: 500;
}

/* Tables */
.table-container {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table { 
    margin-bottom: 0; 
}

.table th {
    background: var(--bg);
    color: var(--navy);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 14px 18px;
    border-bottom: 2px solid var(--border);
}

.table td {
    padding: 14px 18px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.table tbody tr:hover { 
    background: rgba(52, 152, 219, 0.03); 
}

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

/* Buttons */
.btn-primary {
    background: var(--sky);
    border-color: var(--sky);
}

.btn-primary:hover {
    background: var(--sky-dark);
    border-color: var(--sky-dark);
}

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

.btn-success:hover {
    background: var(--green-dark);
    border-color: var(--green-dark);
}

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

.btn-navy:hover {
    background: var(--navy-light);
    border-color: var(--navy-light);
    color: var(--white);
}

/* Badges */
.badge-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-pending { background: #fef5e7; color: var(--orange); }
.badge-assigned { background: #ebf5fb; color: var(--sky); }
.badge-completed { background: #eafaf1; color: var(--green); }
.badge-cancelled { background: #fdedec; color: var(--red); }
.badge-in_progress { background: #f4ecf7; color: var(--purple); }
.badge-paid { background: #eafaf1; color: var(--green); }
.badge-overdue { background: #fdedec; color: var(--red); }
.badge-active { background: #eafaf1; color: var(--green); }
.badge-inactive { background: var(--bg); color: var(--text-light); }
.badge-suspended { background: #fef5e7; color: var(--orange); }

/* Forms */
.form-control:focus, .form-select:focus {
    border-color: var(--sky);
    box-shadow: 0 0 0 0.2rem rgba(52, 152, 219, 0.15);
}

.form-label {
    font-weight: 600;
    color: var(--navy);
    font-size: 0.9rem;
    margin-bottom: 6px;
}

/* Footer */
.app-footer {
    background: var(--white);
    border-top: 1px solid var(--border);
    padding: 14px 24px;
    margin-top: auto;
    font-size: 0.85rem;
}

/* Avatar */
.avatar { 
    width: 40px; 
    height: 40px; 
    border-radius: 50%; 
    overflow: hidden; 
    flex-shrink: 0; 
}

.avatar-sm { width: 32px; height: 32px; }
.avatar-lg { width: 64px; height: 64px; }
.avatar-xl { width: 96px; height: 96px; }

/* Theme Switch */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,0.6);
    font-size: 0.85rem;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 22px;
    margin: 0;
}

.theme-switch input { opacity: 0; width: 0; height: 0; }

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.2);
    transition: var(--transition);
    border-radius: 22px;
}

.slider:before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background: white;
    transition: var(--transition);
    border-radius: 50%;
}

input:checked + .slider { background: var(--sky); }
input:checked + .slider:before { transform: translateX(22px); }

/* Header Search Results */
.header-search {
    position: relative;
}

.header-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    z-index: 1060;
    max-height: 400px;
    overflow-y: auto;
}

.header-search-results .search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
    transition: var(--transition);
}

.header-search-results .search-result-item:hover {
    background: var(--bg);
}

.header-search-results .search-result-item:last-child {
    border-bottom: none;
}

.header-search-results .search-all-link {
    display: block;
    text-align: center;
    padding: 10px;
    background: var(--bg);
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    color: var(--sky);
}

/* PWA Install Button */
#pwaInstallBtn {
    transition: var(--transition);
}

#pwaInstallBtn:hover {
    color: var(--sky) !important;
}

/* Calendar */
.calendar-container {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
}

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

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.calendar-day-header {
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-light);
    padding: 8px;
}

.calendar-day {
    min-height: 100px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.calendar-day:hover { background: var(--bg); }
.calendar-day.today { border-color: var(--sky); background: #ebf5fb; }
.calendar-day.other-month { opacity: 0.4; }
.calendar-day .day-number { font-weight: 600; font-size: 0.9rem; }

.calendar-event {
    background: var(--sky);
    color: var(--white);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.75rem;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-overlay.active { display: flex; }

/* Responsive - Tablets */
@media (max-width: 991.98px) {
    .table th,
    .table td {
        padding: 10px 12px;
    }
    .card-header {
        padding: 14px 18px;
    }
    .card-body {
        padding: 18px;
    }
    .stat-card {
        padding: 18px;
    }
    .stat-value {
        font-size: 1.5rem;
    }
}

/* Responsive - Mobile */
@media (max-width: 767.98px) {
    .sidebar {
        transform: translateX(-100%);
        width: 280px;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .header-search .input-group {
        min-width: auto;
    }
    .header-search .form-control {
        font-size: 0.85rem;
        padding: 6px 8px;
    }
    .header-search .input-group-text {
        padding: 6px 10px;
    }
    .header-search-results {
        width: calc(100vw - 32px);
        max-width: 360px;
    }
    .stat-value { 
        font-size: 1.3rem; 
    }
    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }
    .calendar-day { 
        min-height: 50px; 
    }
    .page-title {
        font-size: 1.3rem;
    }
    .page-header {
        margin-bottom: 20px;
    }
    .app-header {
        padding: 0 12px;
    }
    .stat-card {
        padding: 16px;
    }
    .content-wrapper {
        padding: 12px;
    }
}

/* Responsive - Small Mobile */
@media (max-width: 575.98px) {
    .stat-value {
        font-size: 1.1rem;
    }
    .stat-label {
        font-size: 0.75rem;
    }
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    .table th,
    .table td {
        padding: 8px 10px;
        font-size: 0.8rem;
    }
    .card-header {
        padding: 12px 14px;
        font-size: 0.9rem;
    }
    .card-body {
        padding: 14px;
    }
    .app-footer {
        padding: 10px 14px;
        font-size: 0.75rem;
    }
}
