/* ===========================
   1. Base Typography & Layout
   =========================== */
body {
    font-family: 'Inter', 'Nunito', Arial, sans-serif;
    background: #f9fafb;
    color: #222e3a;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden; /* Prevent horizontal scroll */
}

h1, h2, h3, h4, h5, h6 {
    color: #222e3a;
    font-family: 'Inter', 'Nunito', Arial, sans-serif;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 0.5rem;
}

a {
    color: #18acea;
    text-decoration: none;
    transition: color 0.15s;
}

    a:hover, a:focus {
        color: #4fd1c5;
        text-decoration: underline;
    }

/* ===========================
   STANDARDIZED MARGIN SYSTEM - Based on post_login.html
   =========================== */

/* Default container styling - matches post_login.html center-container */
.container, .container-fluid, main, .center-container {
    max-width: 1400px !important;
    margin: 0 auto !important;
    width: 100% !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Base responsive padding for all main containers */
@media (max-width: 900px) {
    .container, .container-fluid, main, .center-container {
        padding: 0 1rem !important; /* Matches post_login.html mobile padding */
    }
}

@media (min-width: 901px) {
    .container, .container-fluid, main, .center-container {
        padding: 0 0.5rem !important; /* Minimal padding on larger screens */
    }
}

/* Override Bootstrap container responsive breakpoints to match our standard */
@media (min-width: 576px) {
    .container {
        max-width: 100% !important;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 1000px !important;
    }
}

@media (min-width: 992px) {
    .container {
        max-width: 1200px !important;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1400px !important;
    }
}

@media (min-width: 1400px) {
    .container {
        max-width: 1400px !important; /* Keep 1400px as max */
    }
}

/* ===========================
   2. Navbar & Header
   =========================== */
nav, .navbar {
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
    padding: 0.5rem 0;
    font-family: 'Inter', Arial, sans-serif;
    font-size: 1.05rem;
    z-index: 100;
    width: 100%;
}

    nav .container-fluid, .navbar .container-fluid {
        max-width: 1400px;
        margin: 0 auto;
        padding: 0 1rem; /* Standard padding for navbar content */
    }

    nav a, .navbar a {
        color: #222e3a;
        margin-right: 0.8rem;
        font-weight: 500;
        transition: color 0.15s;
    }

        nav a:last-child, .navbar a:last-child {
            margin-right: 0;
        }

        nav a:hover, .navbar a:hover, nav a.active, .navbar a.active {
            color: #18acea;
            text-decoration: underline;
        }

    .navbar .app-logo {
        height: 36px;
        width: auto;
        border-radius: 6px;
        margin-right: 0.3rem;
    }

    .navbar .app-title {
        font-size: 1.25rem;
        font-weight: 700;
        letter-spacing: 0.01em;
    }

/* ===========================
   3. Cards & Content Areas
   =========================== */
.card, .main-content-card {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    margin-bottom: 2rem; /* Standard spacing between cards */
    padding: 1.5rem;
}

.card-header {
    background: #f4f6fa;
    border-bottom: 1px solid #e2e8f0;
    font-weight: 600;
    font-size: 1.1rem;
    border-radius: 1rem 1rem 0 0;
    padding: 0.75rem 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

.shadow-sm {
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
}

/* ===========================
   4. Buttons
   =========================== */
.btn, .btn-modern {
    background: #18acea;
    color: #fff;
    border: none;
    border-radius: 0.7rem;
    padding: 0.6rem 1.4rem;
    font-size: 1rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(24,172,234,0.07);
    margin: 0.25rem;
}

    .btn:hover, .btn:focus, .btn-modern:hover, .btn-modern:focus {
        background: #4fd1c5;
        color: #222e3a;
    }

.btn-outline-primary {
    background: #fff;
    color: #18acea;
    border: 1.5px solid #18acea;
}

    .btn-outline-primary:hover, .btn-outline-primary:focus {
        background: #18acea;
        color: #fff;
    }

.btn-danger, .btn-outline-danger {
    background: #e53e3e;
    color: #fff;
    border: none;
}

.btn-outline-danger {
    background: #fff;
    color: #e53e3e;
    border: 1.5px solid #e53e3e;
}

    .btn-outline-danger:hover, .btn-outline-danger:focus {
        background: #e53e3e;
        color: #fff;
    }

.add-btn {
    background: #4fd1c5;
    color: #222e3a;
}

    .add-btn:hover, .add-btn:focus {
        background: #18acea;
        color: #fff;
    }

.btn-modern.add-btn {
    background: #4fd1c5;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    padding: 0.6rem 1.4rem;
    font-size: 1.1rem;
    box-shadow: 0 2px 8px rgba(79,209,197,0.13);
    transition: background 0.15s, box-shadow 0.15s;
}

    .btn-modern.add-btn:hover, .btn-modern.add-btn:focus {
        background: #18acea;
        color: #fff;
        box-shadow: 0 4px 16px rgba(24,172,234,0.18);
        text-decoration: none;
    }

/* ===========================
   5. Forms
   =========================== */
.form-control, input[type="text"], input[type="email"], input[type="number"], input[type="password"], input[type="date"], input[type="tel"], select, textarea {
    border: 1.5px solid #d1d5db;
    border-radius: 0.7rem;
    padding: 0.55rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    background: #f9fafb;
    color: #222e3a;
    margin-bottom: 0.7rem;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

    .form-control:focus, input:focus, select:focus, textarea:focus {
        border-color: #18acea;
        outline: none;
        background: #fff;
    }

label, .form-label {
    font-weight: 500;
    margin-bottom: 0.3rem;
    color: #222e3a;
}

.large-label {
    font-size: 1.08rem;
}

.large-rounded {
    border-radius: 1.2rem;
    font-size: 1.08rem;
    padding: 0.7rem 1.2rem;
}

/* ===========================
   6. Tables
   =========================== */
table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

th, td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
}

th {
    background: #f4f6fa;
    font-weight: 600;
    color: #222e3a;
}

tr:last-child td {
    border-bottom: none;
}

.table-hover tbody tr:hover {
    background: #f1f3f7;
}

.table-sm th, .table-sm td {
    padding: 0.5rem 0.75rem;
    font-size: 0.97em;
}

/* ===========================
   7. Utility Classes - Standard Spacing
   =========================== */
.text-center {
    text-align: center !important;
}

.text-muted {
    color: #718096 !important;
}

.fw-bold {
    font-weight: 700 !important;
}

.fw-semibold {
    font-weight: 600 !important;
}

/* Standard margin classes - matches post_login.html spacing */
.mb-2 {
    margin-bottom: 0.5rem !important;
}

.mb-3 {
    margin-bottom: 1rem !important;
}

.mb-4 {
    margin-bottom: 2rem !important; /* Standard card spacing */
}

.mt-3 {
    margin-top: 1rem !important;
}

.mt-4 {
    margin-top: 2rem !important;
}

.d-flex {
    display: flex !important;
}

.justify-content-center {
    justify-content: center !important;
}

.justify-content-between {
    justify-content: space-between !important;
}

.align-items-center {
    align-items: center !important;
}

/* Bootstrap grid spacing - matches post_login.html g-4 spacing */
.gap-1 {
    gap: 0.5rem !important;
}

.gap-2 {
    gap: 1rem !important;
}

.gap-3 {
    gap: 1.5rem !important;
}

.gap-4 {
    gap: 2rem !important; /* Standard spacing used in post_login.html */
}

.g-4 > * {
    margin-bottom: 2rem !important;
}

.nxv-gap-075 {
    gap: 0.75rem !important;
}

.stretched-link {
    position: absolute;
    inset: 0;
    z-index: 10;
    text-indent: -9999px;
    background: transparent;
}

    .stretched-link:focus {
        outline: 2px solid #4fd1c5;
    }

/* ===========================
   8. Cards for Insights (matches post_login.html choice-card)
   =========================== */
.insight-card, .choice-card {
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 2px 16px #0002;
    margin-bottom: 2rem;
    min-width: 240px;
}

    .insight-card:hover, .choice-card:hover {
        transform: translateY(-4px) scale(1.03);
        box-shadow: 0 4px 24px #0003;
        z-index: 2;
    }

    .choice-card .card-body {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: 180px;
    }

    .choice-card .btn {
        min-width: 140px;
        margin-top: 1.5rem;
    }

/* ===========================
   9. Universal Search
   =========================== */
.universal-search-container {
    position: relative;
    display: inline-block;
    margin-left: 0.75rem;
}

#universal-search {
    width: 260px;
    border-radius: 1.2rem;
    padding: 0.6rem 1.2rem;
    font-size: 1rem;
    border: 1.5px solid #d1d5db;
    background: #f9fafb;
}

#universal-search-results {
    position: absolute;
    top: 110%;
    left: 0;
    width: 100%;
    background: #fff;
    border: 1.5px solid #e2e8f0;
    border-radius: 0.7rem;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    z-index: 100;
    display: none;
    max-height: 320px;
    overflow-y: auto;
}

.universal-search-container.active #universal-search-results {
    display: block;
}

.search-section {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f1f3f7;
}

    .search-section:last-child {
        border-bottom: none;
    }

/* ===========================
   10. Mobile Styles - Standard Responsive Design
   =========================== */
@media (max-width: 600px) {
    .universal-search-container {
        width: 100%;
        margin-left: 0;
    }

    #universal-search {
        width: 100%;
    }

    .choice-card .btn {
        margin-top: 1rem;
    }

    .choice-card .card-body {
        min-height: 160px;
    }
}

/* ===========================
   11. Dispatch Mobile Field Service
   =========================== */
.header {
    background: #18acea;
    color: #fff;
    padding: 0.75rem 1rem;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 600;
}

.case-list {
    padding: 0.75rem 1rem;
}

.case-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px #0001;
    margin-bottom: 1.2rem;
    padding: 1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    transition: box-shadow 0.2s;
    position: relative;
}

.case-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5em;
}

.case-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #18acea;
    flex: 1;
}

.case-status {
    display: inline-block;
    padding: 0.2em 0.9em;
    border-radius: 1em;
    font-size: 0.92em;
    font-weight: 500;
    color: #fff;
    background: #6c757d;
    margin-left: 0.5em;
    min-width: 80px;
    text-align: center;
}

    .case-status.Open {
        background: #18acea;
    }

    .case-status.EnRoute, .case-status['En Route'] {
        background: #ffc107;
        color: #222;
    }

    .case-status.OnSite, .case-status['On Site'] {
        background: #198754;
    }

    .case-status.Completed {
        background: #6c757d;
    }

.case-meta {
    font-size: 0.97em;
    color: #444;
}

.case-actions {
    display: flex;
    gap: 1em;
    margin-top: 0.5em;
}

.case-action-btn {
    flex: 1;
    background: #f1f3f7;
    border: none;
    border-radius: 6px;
    padding: 0.5em 0;
    color: #18acea;
    font-weight: 500;
    font-size: 1em;
    text-align: center;
    text-decoration: none;
    transition: background 0.15s;
}

    .case-action-btn:active {
        background: #e2e6ea;
    }

.case-link {
    display: block;
    margin-top: 0.5em;
    color: #18acea;
    text-decoration: none;
    font-weight: 500;
    font-size: 1em;
    text-align: right;
}

.no-cases {
    text-align: center;
    color: #888;
    margin-top: 2em;
    font-size: 1.1em;
}

/* ===========================
   12. Miscellaneous
   =========================== */
.section-header {
    font-size: 1.15rem;
    font-weight: 600;
    color: #18acea;
    margin-top: 1.5rem;
    margin-bottom: 0.7rem;
}

.sticky-attachments {
    position: sticky;
    top: 1.5rem;
}

::-webkit-scrollbar {
    width: 8px;
    background: #f4f6fa;
}

::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 4px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: #cbd5e1;
    }

/* ===========================
   13. NexVolt Brand Colors & Gradients
   =========================== */
.nxv-primary {
    color: #18acea !important;
}

.nxv-bg-primary {
    background-color: #18acea !important;
    color: #fff !important;
}

.nxv-border-primary {
    border-color: #18acea !important;
}

/* Buttons */
.btn-nxv, .btn-nxv-primary {
    background: #18acea !important;
    color: #fff !important;
    border: none;
    border-radius: 0.7rem;
    padding: 0.6rem 1.4rem;
    font-size: 1rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(24,172,234,0.07);
}

    .btn-nxv:hover, .btn-nxv:focus, .btn-nxv-primary:hover, .btn-nxv-primary:focus {
        background: #13b3d6 !important;
        color: #fff !important;
    }

.btn-nxv-outline, .btn-nxv-outline-primary {
    background: #fff;
    color: #18acea;
    border: 1.5px solid #18acea;
    border-radius: 0.7rem;
    padding: 0.6rem 1.4rem;
    font-size: 1rem;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
}

    .btn-nxv-outline:hover, .btn-nxv-outline:focus, .btn-nxv-outline-primary:hover, .btn-nxv-outline-primary:focus {
        background: #18acea;
        color: #fff;
    }

.nxv-nav-link {
    color: #18acea !important;
    font-weight: 500;
    transition: color 0.15s;
}

    .nxv-nav-link:hover, .nxv-nav-link:focus {
        color: #13b3d6 !important;
        text-decoration: underline;
    }

.nxv-mb-1 {
    margin-bottom: 1rem !important;
}

.nxv-mb-2 {
    margin-bottom: 2rem !important;
}

.nxv-gap-075 {
    gap: 0.75rem !important;
}

.nxv-w-100 {
    width: 100% !important;
}

.nxv-text-center {
    text-align: center !important;
}

.nxv-py-5 {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
}

.nxv-brand {
    color: #18acea !important;
}

/* Field Service Mobile Background */
.field-service-bg {
    background: url('/static/nexvoltdotllcmobilebackground.png') no-repeat center center;
    background-size: cover;
    min-height: 100vh;
    width: 100%;
}

/* Brand gradient for headers */
h1, h2, h3, h4, h5, h6,
.header,
.nxv-header-gradient {
    background: linear-gradient(90deg, #18acea 0%, #4fd1c5 100%);
    color: #fff !important;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* ===========================
   14. CRM Sidebar & Header
   =========================== */
.sidebar {
    min-width: 70px;
    max-width: 90px;
    padding-left: 0.75rem !important;
    padding-right: 0.75rem !important;
}

    .sidebar .nav-link {
        font-size: 0.95rem;
        padding: 0.75rem 0.5rem;
        text-align: center;
        white-space: nowrap;
    }

.crm-header-navbar {
    border-bottom: 1px solid #e2e8f0;
    background: #fff;
    margin-bottom: 0;
    z-index: 100;
}

.crm-header-link {
    color: #222e3a;
    font-weight: 600;
    font-size: 1.08rem;
    padding: 0.75rem 1.2rem;
    border-radius: 1.2rem;
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    letter-spacing: 0.01em;
}

    .crm-header-link.active,
    .crm-header-link:hover,
    .crm-header-link:focus {
        background: #e6f7fa;
        color: #18acea;
        text-decoration: none;
    }

.header-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 600px;
    text-align: center;
}

.header-logo {
    margin-top: 120px;
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

    .header-logo img {
        height: auto;
        max-width: 220px;
        max-height: 90px;
        border-radius: 16px;
        box-shadow: 0 2px 12px #18acea22;
        display: block;
        margin: 0 auto;
        object-fit: contain;
    }

.case-map img {
    width: 100%;
    max-width: 100%;
    display: block;
    border-radius: 8px;
    box-shadow: 0 2px 8px #0001;
}

/* Fix for logout button */
.btn.logout, .btn-outline-gradient.logout {
    background: #fff !important;
    color: #18acea !important;
    border: 2px solid #18acea !important;
}

    .btn.logout:hover, .btn-outline-gradient.logout:hover,
    .btn.logout:focus, .btn-outline-gradient.logout:focus {
        background: #18acea !important;
        color: #fff !important;
    }

/* ===========================
   15. Footer and Main Content Spacing
   =========================== */

/* Footer spacing */
footer {
    margin-top: 2rem !important;
    padding: 1.5rem 1rem !important;
}

/* Main content areas */
main {
    padding-top: 1rem !important;
    padding-bottom: 1rem !important;
}

/* Alert spacing */
.alert {
    margin-bottom: 1rem !important;
    padding: 0.75rem 1rem !important;
}

/* Form group spacing */
.form-group, .mb-3 {
    margin-bottom: 1rem !important;
}

/* Section spacing */
section {
    margin-bottom: 2rem !important;
    padding: 1rem !important;
}

/* List spacing */
ul, ol {
    margin-bottom: 1rem !important;
    padding-left: 1.5rem !important;
}

li {
    margin-bottom: 0.25rem !important;
}

/* Panel and widget spacing */
.panel, .widget, .component {
    margin-bottom: 1.5rem !important;
    padding: 1.5rem !important;
}

/* Modal spacing */
.modal-body {
    padding: 1.5rem !important;
}

.modal-header, .modal-footer {
    padding: 1rem 1.5rem !important;
}

/* Dropdown spacing */
.dropdown-menu {
    padding: 0.5rem 0 !important;
}

.dropdown-item {
    padding: 0.5rem 1rem !important;
}

/* Tab content spacing */
.tab-content {
    padding-top: 1rem !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Breadcrumb spacing */
.breadcrumb {
    margin-bottom: 1rem !important;
    padding: 0.75rem 1rem !important;
}

/* Bootstrap grid with standard spacing */
.row {
    margin-left: -1rem !important;
    margin-right: -1rem !important;
}

    .row > * {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

/* Full width utility class */
.full-width {
    width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
}

/* App title styling from post_login.html */
.app-title {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    background: linear-gradient(90deg, #18acea 0%, #4fd1c5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-fill-color: transparent;
    display: block;
}

.header-brand-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem;
    position: relative;
}

.app-logo {
    height: 36px;
    width: auto;
    border-radius: 6px;
}

/* External links styling from post_login.html */
.external-links .choice-card .btn {
    margin-top: 1rem;
}

.external-links .choice-card img {
    margin-bottom: 1rem;
}

/* Main cards styling from post_login.html */
.main-cards {
    flex: 3;
}

@media (max-width: 900px) {
    .main-cards, .external-links {
        width: 100%;
        margin-bottom: 2rem;
    }
}
