﻿:root {
    --sindhoor: #3f3d6f;
    --sindhoor-dark: #2c265f;
    --bg: #fafafa;
    --card-bg: #fff;
    --text: #333;
    --header-h: 64px;
    --sidebar-w: 250px;
}

/* GLOBAL */
* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    font-family: "Inter", sans-serif;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    /* Sticky footer layout */
    min-height: 100vh; /* make page at least viewport height */
    display: flex; /* vertical stack: header, main, footer */
    flex-direction: column; /* needed for margin-top:auto on footer */
    padding-top: var(--header-h); /* reserve space for fixed header */
}

/* HEADER */
header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-h);
    background: var(--sindhoor);
    color: #fff;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: "Montserrat", sans-serif;
    font-weight: 700;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    z-index: 1000;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.25rem;
}

    .logo i {
        font-size: 1.5rem;
    }

.hamburger {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
}

/* HEADER ACTIONS */
.header-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

    .header-actions .icon {
        position: relative;
        cursor: pointer;
    }

    .header-actions i {
        font-size: 1.15rem;
    }

.badge {
    position: absolute;
    top: -6px;
    right: -8px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #fff;
    color: var(--sindhoor);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* SIDEBAR */
.sidebar {
    position: fixed;
    top: var(--header-h);
    left: 0;
    width: var(--sidebar-w);
    height: calc(100vh - var(--header-h));
    background: var(--card-bg);
    padding: 16px;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
    z-index: 500;
}

    .sidebar .section-label {
        font-size: 0.8rem;
        color: #888;
        font-weight: 700;
        margin-bottom: 8px;
    }

    .sidebar nav a {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 10px 12px;
        border-radius: 12px;
        text-decoration: none;
        color: var(--text);
        font-weight: 600;
        transition: background 0.2s, color 0.2s;
    }

        .sidebar nav a.active,
        .sidebar nav a:hover {
            background: var(--sindhoor);
            color: #fff;
        }

/* OVERLAY */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.3);
    z-index: 400;
}

/* CONTENT */
.content {
    margin-left: var(--sidebar-w);
    padding: 24px;
    /* flex child that grows to push footer down */
    min-height: 0; /* avoid overflow issues in flex container */
    flex: 1 0 auto; /* fill remaining vertical space */
}

/* Allow auth pages without sidebar to be full width */
.auth-layout .content.no-sidebar {
    margin-left: 0;
}

/* KPI CARDS */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 18px;
}

.kpi {
    background: var(--card-bg);
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

    .kpi .meta {
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

        .kpi .meta .label {
            font-weight: 700;
            color: #666;
            font-size: .95rem;
        }

        .kpi .meta .value {
            font-size: 1.45rem;
            font-weight: 800;
            color: var(--sindhoor);
        }

    .kpi .icon {
        background: linear-gradient(135deg, rgba(22,85,143,0.12), rgba(22,85,143,0.04));
        border-radius: 10px;
        padding: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        color: var(--sindhoor);
        font-size: 1.1rem;
        width: 48px;
        height: 48px;
    }

/* DASH GRID */
.dash-grid {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 18px;
    align-items: start;
}

@media (max-width:1100px) {
    .dash-grid {
        grid-template-columns: 1fr;
    }
}

/* PANELS */
.panel {
    background: var(--card-bg);
    padding: 14px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}

    .panel h3 {
        margin: 0 0 10px 0;
        font-size: 1rem;
        font-weight: 700;
        color: #333;
    }

/* CHART WRAPPERS */
.chart-wrapper {
    height: 320px;
    display: block;
}

    .chart-wrapper.small {
        height: 220px;
    }

@media (max-width: 768px) {
    .chart-wrapper {
        height: 260px;
    }
}

/* FAST TABLE */
.fast-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .95rem;
}

    .fast-table th,
    .fast-table td {
        text-align: left;
        padding: 8px;
        border-bottom: 1px solid #eee;
    }

    .fast-table th {
        color: #666;
        background: transparent;
        font-weight: 700;
    }

/* TABLE */
.table-container {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-top: 20px;
}

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 12px;
}

.search-box input.form-control,
.rows-per-page select.form-select {
    padding: 6px 12px;
    border-radius: 8px;
    border: 2px solid var(--sindhoor);
    outline: none;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #f7f7f7;
    font-weight: 600;
    position: sticky;
    top: 0;
}

/* BUTTONS */
.btn {
    display: inline-block;
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 0.75rem;
}

.btn-primary {
    background: var(--sindhoor);
    color: #fff;
}

    .btn-primary:hover {
        background: var(--sindhoor-dark);
    }

.btn-danger {
    background: #e74c3c;
    color: #fff;
}

    .btn-danger:hover {
        background: #c0392b;
    }

/* SEARCH WRAPPER */
.search-wrapper {
    position: relative;
    width: 250px;
}

    .search-wrapper input.form-control {
        width: 100%;
        padding: 8px 12px 8px 36px;
        border-radius: 20px;
        border: 2px solid var(--sindhoor);
        outline: none;
        font-size: 0.9rem;
        transition: all 0.3s ease;
        background-color: #fff;
        box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    }

        .search-wrapper input.form-control:focus {
            border-color: var(--sindhoor-dark);
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        }

    .search-wrapper .search-icon {
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        color: var(--sindhoor);
        font-size: 1rem;
        pointer-events: none;
        transition: color 0.3s ease;
    }

    .search-wrapper input.form-control:focus + .search-icon {
        color: var(--sindhoor-dark);
    }

/* TABLE ROW COLORS */
#locationsTable tbody tr:nth-child(odd) {
    background-color: #f1f5ff;
}

#locationsTable tbody tr:nth-child(even) {
    background-color: #ffffff;
}

#locationsTable tbody tr:hover {
    background-color: #e6e0ff;
}

tr.highlight {
    background-color: #fff9c4;
}

/* PAGINATION */
.pagination {
    display: flex;
    gap: 6px;
    margin-top: 14px;
    flex-wrap: wrap;
}

    .pagination button {
        border: none;
        cursor: pointer;
        border-radius: 6px;
        padding: 6px 10px;
        background: var(--sindhoor);
        color: #fff;
        transition: background 0.2s;
    }

        .pagination button.active {
            background: var(--sindhoor-dark);
        }

        .pagination button:disabled {
            background: #ccc;
            cursor: not-allowed;
        }

.goto-page {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    font-weight: 600;
    color: var(--sindhoor);
}

    .goto-page input {
        width: 50px;
        text-align: center;
        border-radius: 6px;
        border: 2px solid var(--sindhoor);
        padding: 4px 6px;
    }

/* UTILITY */
.muted {
    color: #777;
    font-size: .95rem;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .content {
        margin-left: 0; /* collapse sidebar layout on small screens */
    }

    .hamburger {
        display: inline-block;
    }

    .sidebar {
        transform: translateX(-100%);
    }

        .sidebar.open {
            transform: translateX(0);
        }

    .overlay.active {
        display: block;
    }

    table,
    thead,
    tbody,
    th,
    td,
    tr {
        display: block;
        width: 100%;
    }

    thead {
        display: none;
    }

    tr {
        margin-bottom: 16px;
        background: var(--card-bg);
        border-radius: 12px;
        padding: 12px;
    }

    td {
        border: none;
        padding: 6px 0;
        text-align: right;
        position: relative;
    }

        td::before {
            content: attr(data-label);
            float: left;
            font-weight: 600;
            text-transform: capitalize;
        }
}

/* ===================== */
/* FORM STYLES (THEME)   */
/* ===================== */

.form-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.form-card {
    background: var(--card-bg);
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 40px;
    width: 100%;
    max-width: 900px;
}

    .form-card h2 {
        font-family: 'Montserrat', sans-serif;
        color: var(--sindhoor-dark);
        margin-bottom: 25px;
        text-align: center;
    }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

    .form-group label {
        font-weight: 600;
        font-size: 0.95rem;
    }

    .form-group input,
    .form-group textarea,
    .form-group select {
        padding: 10px 14px;
        border-radius: 12px;
        border: 2px solid var(--sindhoor);
        font-size: 1rem;
        outline: none;
    }

        .form-group input:focus,
        .form-group textarea:focus,
        .form-group select:focus {
            border-color: var(--sindhoor-dark);
        }

.actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.btn {
    padding: 12px 20px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
}

.btn-primary {
    background: var(--sindhoor);
    color: #fff;
}

    .btn-primary:hover {
        background: var(--sindhoor-dark);
    }

.btn-secondary {
    background: #ccc;
    color: #333;
}

    .btn-secondary:hover {
        background: #aaa;
    }

/* ============================= */
/* Existing Table Controls Rules */
/* ============================= */
@media (max-width: 768px) {
    .table-controls {
        display: flex;
        flex-wrap: wrap;
        gap: 10px;
        justify-content: flex-start; /* keep left aligned */
    }

    .search-box {
        flex: 1 1 100%; /* search stays full width on first row */
    }

    .rows-per-page {
        flex: 1 1 auto; /* goes next on left */
    }

    .goto-page {
        flex: 1 1 auto; /* goes next to rows-per-page */
    }
}

@media (max-width: 480px) {
    .rows-per-page,
    .goto-page {
        font-size: 0.9rem;
    }

        .goto-page input {
            width: 70px;
        }
}

/* ============================= */
/* Create Form Responsive Styles */
/* ============================= */

/* For 425px (common mobile devices) */
@media (max-width: 425px) {
    .form-container {
        padding: 12px;
    }

    .form-card {
        padding: 18px;
        border-radius: 8px;
        box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    }

    .form-grid {
        display: flex;
        flex-direction: column;
        gap: 14px;
    }

    .form-group {
        width: 100%;
    }

        .form-group input {
            width: 100%;
            font-size: 1rem;
            padding: 9px;
        }

    .actions {
        display: flex;
        flex-direction: column;
        gap: 10px;
        margin-top: 12px;
    }

        .actions .btn {
            width: 100%;
            font-size: 1rem;
        }
}

/* For 320px (extra small devices) */
@media (max-width: 320px) {
    .form-container {
        padding: 10px;
    }

    .form-card {
        padding: 15px;
        border-radius: 8px;
        box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    }

    .form-grid {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .form-group {
        width: 100%;
    }

        .form-group input {
            width: 100%;
            font-size: 0.9rem;
            padding: 8px;
        }

    .actions {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin-top: 10px;
    }

        .actions .btn {
            width: 100%;
            font-size: 0.9rem;
        }
}

/* ============================= */
/* Mobile Responsive for Home Page (KPI + Charts) */
/* Only affects mobile, desktop untouched */
/* ============================= */

/* Tablet <= 768px */
@media (max-width: 768px) {
    .kpi-grid {
        grid-template-columns: 1fr 1fr; /* 2 KPIs per row */
    }

    .kpi {
        padding: 10px;
        gap: 10px;
    }

        .kpi .label {
            font-size: 0.85rem;
        }

        .kpi .value {
            font-size: 1.2rem;
        }

    .panel {
        padding: 10px;
    }

        .panel h3 {
            font-size: 1rem;
        }

        .panel canvas {
            width: 100% !important; /* force full width */
            height: auto !important; /* auto height scaling */
        }
}

/* Mobile <= 425px */
@media (max-width: 425px) {
    .kpi-grid {
        grid-template-columns: 1fr; /* stack KPIs */
    }

    .kpi {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 8px;
        gap: 8px;
    }

        .kpi .label {
            font-size: 0.8rem;
        }

        .kpi .value {
            font-size: 1.1rem;
        }

    .panel {
        padding: 8px;
    }

        .panel h3 {
            font-size: 0.95rem;
        }

        .panel canvas {
            width: 100% !important;
            height: auto !important;
        }
}

/* Extra small devices <= 320px */
@media (max-width: 320px) {
    .kpi {
        flex-direction: column; /* icon below text */
        align-items: flex-start;
        gap: 6px;
        padding: 6px;
    }

        .kpi .label {
            font-size: 0.75rem;
        }

        .kpi .value {
            font-size: 1rem;
        }

    .panel {
        padding: 6px;
    }

        .panel h3 {
            font-size: 0.9rem;
        }

        .panel canvas {
            width: 100% !important;
            height: auto !important;
        }
}

/* Reusable sortable table styles */
th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    white-space: nowrap;
}

    th.sortable .arrow {
        margin-left: 6px;
        display: inline-block;
        width: 0;
        height: 0;
        border-left: 4px solid transparent;
        border-right: 4px solid transparent;
        border-top: 6px solid #bbb; /* up arrow base */
        transform: translateY(-1px);
        opacity: 0.6;
    }

    th.sortable.desc .arrow {
        border-top: none;
        border-bottom: 6px solid #bbb; /* down arrow base */
        transform: translateY(1px);
    }

    th.sortable.active .arrow {
        border-top-color: #333;
        border-bottom-color: #333;
        opacity: 1;
    }

    /* Remove default focus ring on sortable headers only */
    th.sortable:focus {
        outline: none;
        box-shadow: none;
    }

/* FOOTER */
footer {
    background: #fff;
    color: #555;
    padding: 40px 5%;
    margin-top: 150px;
    margin-left: -20px;
    margin-right: -20px;
}

.footer-container {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
}

.footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

    .footer-col ul li {
        margin-bottom: 8px;
    }

        .footer-col ul li a {
            text-decoration: none;
            color: #555;
            font-size: .95rem;
        }

            .footer-col ul li a:hover {
                color: var(--sindhoor);
            }

.payments {
    display: flex;
    gap: 12px;
    align-items: center;
}

    .payments img {
        height: 28px;
        filter: grayscale(20%);
    }

/*singup form*/
.signup-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    padding: 40px;
    width: 100%;
    max-width: 480px;
    margin: auto;
}

    .signup-card h2 {
        font-family: 'Montserrat', sans-serif;
        color: #2f2c50;
        margin-bottom: 25px;
        text-align: center;
    }

    .signup-card form {
        display: flex;
        flex-direction: column;
        gap: 18px;
    }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

    .form-group label {
        font-weight: 600;
        font-size: 0.95rem;
        text-align: left;
    }

    .form-group input[type="text"],
    .form-group input[type="email"],
    .form-group input[type="password"] {
        width: 100%;
        padding: 10px 14px;
        border-radius: 12px;
        border: 2px solid #3f3d6f;
        outline: none;
        font-size: 1rem;
    }

        .form-group input[type="text"]:focus,
        .form-group input[type="email"]:focus,
        .form-group input[type="password"]:focus {
            border-color: #2f2c50;
        }

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

    .checkbox-group input[type="checkbox"] {
        transform: scale(1.2);
        margin-right: 8px;
    }

.signup-card button {
    background: #3f3d6f;
    border: none;
    padding: 12px;
    color: #fff;
    font-size: 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    margin-top: 10px;
}

    .signup-card button:hover {
        background: #2f2c50;
    }

.signup-card .alt-link {
    margin-top: 16px;
    font-size: 0.9rem;
    text-align: center;
}

    .signup-card .alt-link a {
        color: #3f3d6f;
        text-decoration: none;
        font-weight: 600;
    }

        .signup-card .alt-link a:hover {
            text-decoration: underline;
        }

/*User Profile*/
/* Header user dropdown */
.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-menu {
    position: relative;
}

/* Transparent background, white text */
.user-button {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    border-radius: 10px;
    background: transparent;
    color: #fff;
    border: 1px solid transparent;
    cursor: pointer;
}

    .user-button:hover, .user-button:focus-visible {
        background: rgba(255,255,255,0.06);
        border-color: rgba(255,255,255,0.12);
        outline: none;
    }

.avatar-initials {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: transparent;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    box-shadow: inset 0 0 0 2px rgba(255,255,255,0.5);
}

.user-name {
    max-width: 160px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 600;
    color: #fff;
}

.user-caret {
    color: #fff;
    font-size: .9rem;
}

/* Dark dropdown for contrast, white text */
.dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    min-width: 180px;
    background: #111827; /* slate-900 like */
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
    display: none;
    padding: 8px;
    z-index: 1000;
    color: #fff;
}

    .dropdown.open {
        display: block;
    }

    .dropdown .item {
        display: block;
        width: 100%;
        text-align: left;
        border: 0;
        background: transparent;
        padding: 10px 12px;
        border-radius: 8px;
        cursor: pointer;
        color: #fff;
    }

        .dropdown .item:hover {
            background: rgba(255,255,255,0.08);
        }

/* Keep existing sidebar layout intact */
.sidebar {
    display: flex;
    flex-direction: column;
}

/* Extra CSS to swap full name with short form in mobile */
.logo .short-name {
    display: none;
}

.logo .full-name {
    display: inline;
}

@media (max-width: 768px) {
    .logo .short-name {
        display: inline;
    }

    .logo .full-name {
        display: none;
    }
}