/* Premium Administrative Dashboard Stylesheet */

:root {
    --bg-main: #f1f5f9;
    --bg-card: rgba(255, 255, 255, 0.9);
    --border-card: rgba(0, 0, 0, 0.05);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active: #ffffff;
    --sidebar-hover-bg: rgba(255, 255, 255, 0.06);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --pending: #3b82f6;
}

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

body.admin-body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-main), sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

.admin-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
}

/* Sidebar Navigation */
.admin-sidebar {
    width: 280px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-brand {
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand .icon {
    font-size: 24px;
    color: var(--primary);
    filter: drop-shadow(0 2px 8px rgba(10, 132, 255, 0.3));
}

.sidebar-brand h2 {
    font-size: 1.15rem;
    font-weight: 800;
    color: white;
    letter-spacing: -0.5px;
}

.sidebar-brand p {
    font-size: 0.75rem;
    opacity: 0.6;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 14px;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 6px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.sidebar-nav a:hover {
    background-color: var(--sidebar-hover-bg);
    color: white;
}

.sidebar-nav a.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(10, 132, 255, 0.25);
}

.sidebar-nav a i {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

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

.btn-logout {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    color: #f87171;
    background-color: rgba(239, 68, 68, 0.08);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background-color: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* Main Panel Wrapper */
.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Prevent flex blowout */
}

/* Top Navigation Bar */
.admin-topbar {
    background-color: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    height: 75px;
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-card);
    position: sticky;
    top: 0;
    z-index: 90;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    display: none;
}

.page-title {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 12px rgba(10, 132, 255, 0.15);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(10, 132, 255, 0.25);
}

.btn-secondary {
    background-color: #cbd5e1;
    color: var(--dark);
}

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

.btn-success:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

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

.btn-danger:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.btn-outline {
    border: 1px solid #cbd5e1;
    background-color: transparent;
    color: var(--text-main);
}

.btn-view-site {
    background-color: rgba(10, 132, 255, 0.08);
    color: var(--primary);
    border: 1px solid rgba(10, 132, 255, 0.15);
}

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

.admin-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    border-left: 1px solid rgba(0, 0, 0, 0.08);
    padding-left: 20px;
}

.admin-profile .avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background-color: var(--primary);
    color: white;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.admin-profile .name {
    font-weight: 600;
    font-size: 0.9rem;
}

/* Content wrapper */
.admin-content {
    padding: 30px;
    max-width: 1400px;
    width: 100%;
}

/* Metric KPI grids */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.metric-card {
    background-color: var(--bg-card);
    border-radius: 20px;
    padding: 24px;
    border: 1px solid var(--border-card);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.01);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: transform 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-3px);
}

.metric-info h3 {
    font-size: 0.88rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.metric-info .val {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.metric-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
}

.bg-blue { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.bg-green { background: linear-gradient(135deg, #10b981, #34d399); }
.bg-purple { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }
.bg-orange { background: linear-gradient(135deg, #f59e0b, #fbbf24); }

/* Dashboard Grids */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

.card {
    background-color: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border-card);
    padding: 24px;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.01);
    margin-bottom: 24px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    border-bottom: 1px solid #f1f5f9;
    padding-bottom: 12px;
}

.card-header h2 {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.3px;
}

/* Tables style */
.table-wrapper {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.admin-table th {
    padding: 14px 16px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #f1f5f9;
}

.admin-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #f8fafc;
    font-size: 0.9rem;
}

.admin-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.01);
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-pending { background-color: rgba(59, 130, 246, 0.1); color: var(--pending); }
.status-assigned { background-color: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.status-progress { background-color: rgba(245, 158, 11, 0.1); color: var(--warning); }
.status-completed { background-color: rgba(16, 185, 129, 0.1); color: var(--success); }
.status-cancelled { background-color: rgba(239, 110, 110, 0.1); color: var(--danger); }

/* Technician card roster */
.tech-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #cbd5e1;
    display: inline-block;
    vertical-align: middle;
    margin-right: 8px;
}

.tech-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.tech-card {
    background-color: var(--bg-card);
    border-radius: 16px;
    border: 1px solid var(--border-card);
    padding: 20px;
    text-align: center;
    position: relative;
}

.tech-card .profile-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 15px auto;
    border: 3px solid white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.tech-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.tech-card .specialty {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 12px;
}

.tech-card .phone {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 15px;
    display: block;
    text-decoration: none;
}

.tech-card .badges {
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* Forms layout */
.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.form-row .form-group {
    flex: 1;
}

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

.form-group label {
    display: block;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border-radius: 10px;
    border: 1px solid #cbd5e1;
    background-color: white;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.15);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* Alerts style */
.alert {
    padding: 14px 20px;
    border-radius: 12px;
    font-size: 0.92rem;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Responsive breakdowns */
@media (max-width: 991px) {
    .admin-sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        z-index: 1005; /* Sit fully above all overlays */
    }
    
    .admin-sidebar.open {
        left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    /* Hide topbar search on tablet/mobile screens */
    .admin-topbar form {
        display: none !important;
    }
    /* Hide view website text, keeping just the icon */
    .btn-view-site span {
        display: none;
    }
    .btn-view-site {
        padding: 8px 12px !important;
    }
    /* Hide admin profile name, leaving just avatar */
    .admin-profile .name {
        display: none !important;
    }
    .admin-profile {
        padding-left: 10px !important;
    }
    /* Form row stacking on mobile */
    .form-row {
        flex-direction: column !important;
        gap: 0 !important;
    }
}

@media (max-width: 575px) {
    .admin-topbar {
        padding: 0 15px;
    }
    .admin-content {
        padding: 15px;
    }
    .page-title {
        font-size: 1.05rem !important;
    }
    .btn-view-site {
        display: none !important;
    }
    .card-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }
    .card-header .btn {
        width: 100% !important;
    }
}
