/* =========================================
   Admin & Client Portal Styles
   Theme: Purple/Blue Modern Dashboard
========================================= */

:root {
    --sidebar-bg: #1e1b4b; /* Deep Dark Purple */
    --sidebar-hover: #2e2a6b;
    --sidebar-active: #4f46e5; /* Vibrant Blue/Purple */
    --sidebar-text: #9ca3af;
    --sidebar-text-hover: #ffffff;
    
    --main-bg: #f4f7fe; /* Light background */
    --card-bg: #ffffff;
    
    --banner-gradient: linear-gradient(135deg, #5a67d8 0%, #4c51bf 100%);
    --btn-primary: #0061ff; /* Bright Blue */
    
    --text-dark: #1e293b;
    --text-muted: #64748b;
    
    --radius-lg: 1rem;
    --radius-md: 0.75rem;
    --radius-sm: 0.5rem;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--main-bg);
    color: var(--text-dark);
}

.admin-wrapper {
    display: flex;
    min-height: 100vh;
    flex-direction: row;
}

/* Sidebar Styling */
.admin-sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    transition: all 0.3s ease;
}

.sidebar-logo {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    padding: 0 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.menu-label {
    color: var(--sidebar-text);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 1rem 0 0.5rem 1rem;
}

.admin-sidebar a {
    display: flex;
    align-items: center;
    color: var(--sidebar-text);
    text-decoration: none;
    padding: 0.85rem 1rem;
    margin-bottom: 0.25rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: all 0.2s ease;
}

.admin-sidebar a:hover {
    background-color: var(--sidebar-hover);
    color: var(--sidebar-text-hover);
}

.admin-sidebar a.active {
    background-color: var(--sidebar-active);
    color: #ffffff;
}

/* Main Content Area */
.admin-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

/* Topbar Styling */
.admin-topbar {
    background-color: var(--card-bg);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05); /* Alternative to border-bottom */
}

.topbar-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-new-order {
    background-color: var(--btn-primary);
    color: #ffffff;
    padding: 0.6rem 1.25rem;
    border-radius: 2rem;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
}

/* Welcome Banner */
.welcome-banner {
    background: var(--banner-gradient);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem;
    color: #ffffff;
    margin-bottom: 2rem;
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
}

.welcome-banner h2 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.welcome-banner p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    display: flex;
    flex-direction: column;
}

.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.icon-blue { background-color: #e0e7ff; color: #4f46e5; }
.icon-red { background-color: #fee2e2; color: #ef4444; }
.icon-yellow { background-color: #fef3c7; color: #f59e0b; }
.icon-green { background-color: #d1fae5; color: #10b981; }

.stat-card h3 {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-dark);
}

/* Responsive Design */
@media (max-width: 992px) {
    .admin-sidebar {
        width: 200px;
    }
}

@media (max-width: 768px) {
    .admin-wrapper {
        flex-direction: column;
    }
    
    .admin-sidebar {
        width: 100%;
        padding: 1rem;
    }
    
    .admin-content {
        padding: 1rem;
    }
    
    .admin-topbar {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================
   Forms, Alerts & Login Screen
========================================= */

/* Login Screen Centered Layout */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-color: var(--main-bg);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-card {
    background-color: var(--card-bg);
    padding: 2.5rem 2rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h2 {
    color: var(--primary-dark);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* General Form Card used in Settings */
.form-card {
    background-color: var(--card-bg);
    padding: 2rem;
    border-radius: var(--radius-md);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02);
    max-width: 600px;
}

/* Form Controls */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    color: var(--text-dark);
    background-color: var(--bg-light);
    border: none;
    border-radius: var(--radius-sm);
    box-shadow: inset 0 0 0 1px #e2e8f0; /* Alternative to border */
    transition: box-shadow 0.2s ease;
}

.form-control:focus {
    outline: none;
    box-shadow: inset 0 0 0 2px var(--btn-primary);
}

/* Buttons */
.btn {
    display: inline-block;
    font-weight: 500;
    text-align: center;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-primary {
    background-color: var(--btn-primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: #0052cc;
    box-shadow: 0 4px 12px rgba(0, 97, 255, 0.2);
}

.btn-block {
    display: block;
    width: 100%;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.alert-danger {
    background-color: #fef2f2;
    color: #dc2626;
    box-shadow: inset 0 0 0 1px #f87171;
}

.alert-success {
    background-color: #f0fdf4;
    color: #16a34a;
    box-shadow: inset 0 0 0 1px #4ade80;
}

/* =========================================
   Off-Canvas Sidebar & Header Layout
========================================= */

/* Sidebar Header Area */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 0 0.5rem;
}

.sidebar-logo {
    color: #ffffff;
    font-size: 1.5rem;
    font-weight: 800;
    text-decoration: none;
    letter-spacing: 0.5px;
}

/* Close Button (Hidden on Desktop) */
.close-sidebar {
    display: none;
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.close-sidebar:hover {
    color: #ffffff;
}

/* Overlay Background */
.sidebar-overlay {
    display: none;
}

/* Mobile Toggle Button (Hamburger menu inside topbar) */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-dark);
    cursor: pointer;
    margin-right: 1rem;
}

.topbar-left {
    display: flex;
    align-items: center;
}

/* =========================================
   Mobile Responsiveness (Off-Canvas Logic)
========================================= */
@media (max-width: 992px) {
    /* Show mobile hamburger toggle */
    .mobile-menu-toggle {
        display: inline-block;
    }

    /* Convert Sidebar to Off-Canvas */
    .admin-sidebar {
        position: fixed;
        top: 0;
        left: -300px; /* Hidden off-screen by default */
        height: 100vh;
        width: 260px;
        z-index: 1000;
        box-shadow: 4px 0 25px rgba(0, 0, 0, 0.15); /* Shadow instead of border */
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1); /* Smooth slide effect */
        overflow-y: auto;
    }

    /* Active state for Sidebar */
    .admin-sidebar.active {
        left: 0;
    }

    /* Show Close Button */
    .close-sidebar {
        display: block;
    }

    /* Dark Overlay Setup */
    .sidebar-overlay {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background-color: rgba(15, 23, 42, 0.6); /* Dark semi-transparent */
        backdrop-filter: blur(3px); /* Premium blur effect */
        z-index: 999;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease-in-out;
    }

    /* Active state for Overlay */
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
}

/* =========================================
   Data Tables & Pagination
========================================= */

.table-card {
    background-color: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    padding: 1.5rem;
    margin-top: 1rem;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on mobile */
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px; /* Forces scroll on small devices to prevent squishing */
}

.admin-table th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem;
    text-align: left;
    border-bottom: 2px solid #e2e8f0;
}

.admin-table td {
    padding: 1rem;
    color: var(--text-dark);
    font-size: 0.875rem;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: middle;
}

.admin-table tbody tr:hover td {
    background-color: #f8fafc;
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
}

.badge-active {
    background-color: #d1fae5;
    color: #059669;
}

.badge-suspended {
    background-color: #fee2e2;
    color: #dc2626;
}

.badge-inactive {
    background-color: #f3f4f6;
    color: #4b5563;
}

/* Action Buttons */
.btn-action {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    margin-right: 0.5rem;
    transition: color 0.2s ease;
}

.btn-action.edit {
    color: var(--btn-primary);
}

.btn-action.edit:hover {
    color: #004ecc;
    text-decoration: underline;
}

.btn-action.delete {
    color: #ef4444;
}

.btn-action.delete:hover {
    color: #b91c1c;
    text-decoration: underline;
}

.empty-state {
    padding: 3rem !important;
    color: var(--text-muted) !important;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0; /* Simple separator */
}

.page-link {
    background-color: var(--bg-light);
    color: var(--text-dark);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.page-link:hover {
    background-color: #e2e8f0;
}

.page-info {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* =========================================
   Service Management Layout
========================================= */

.service-layout {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 1.5rem;
    align-items: start;
}

.service-form-card {
    max-width: 100%; /* Override default max-width for grid */
    margin-top: 0;
}

.service-form-card h3,
.service-table-card h3 {
    font-size: 1.125rem;
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    font-weight: 700;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    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='%23475569' 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: right 1rem center;
    background-size: 1em;
    padding-right: 2.5rem;
}

.badge-hidden {
    background-color: #f1f5f9;
    color: #64748b;
}

/* Service Page Responsiveness */
@media (max-width: 1024px) {
    .service-layout {
        grid-template-columns: 300px 1fr;
    }
}

@media (max-width: 768px) {
    .service-layout {
        grid-template-columns: 1fr;
    }
    
    .service-form-card {
        order: 1; /* Form on top in mobile */
    }
    
    .service-table-card {
        order: 2; /* Table below form in mobile */
    }
}