/* ==========================================================================
   Salesforce Lightning Design System (SLDS) Theme - Mobile Native Refinement
   ========================================================================== */

:root {
    /* Salesforce Brand Palette */
    --slds-blue-brand: #0176D3;
    --slds-blue-dark: #032D60;
    --slds-blue-hover: #005fb2;
    --slds-blue-light: #f3f8fe;
    --slds-bg-app: #f4f6f9;
    --slds-card-bg: #ffffff;
    --slds-text-main: #181818;
    --slds-text-subtle: #54698d;
    --slds-border-color: #dddbda;
    --slds-border-radius: 6px;
    --slds-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.06);

    /* Status Colors */
    --color-matched: #2e7d32;
    --color-matched-bg: #e8f5e9;
    --color-missing-2b: #c62828;
    --color-missing-2b-bg: #ffebee;
    --color-missing-pur: #6a1b9a;
    --color-missing-pur-bg: #f3e5f5;
    --color-gst-diff: #ef6c00;
    --color-gst-diff-bg: #fff3e0;
    --color-amt-diff: #f57f17;
    --color-amt-diff-bg: #fffde7;
    --color-duplicate: #1565c0;
    --color-duplicate-bg: #e3f2fd;
}

body.dark-mode {
    --slds-bg-app: #0b1329;
    --slds-card-bg: #17223b;
    --slds-text-main: #f8fafc;
    --slds-text-subtle: #94a3b8;
    --slds-border-color: #2a3859;
    --slds-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);

    --color-matched-bg: #064e3b;
    --color-matched: #6ee7b7;
    --color-missing-2b-bg: #7f1d1d;
    --color-missing-2b: #fca5a5;
    --color-missing-pur-bg: #581c87;
    --color-missing-pur: #d8b4fe;
    --color-gst-diff-bg: #7c2d12;
    --color-gst-diff: #fdba74;
    --color-amt-diff-bg: #713f12;
    --color-amt-diff: #fde047;
    --color-duplicate-bg: #1e3a8a;
    --color-duplicate: #93c5fd;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--slds-bg-app);
    color: var(--slds-text-main);
    line-height: 1.4;
    font-size: 13px;
    -webkit-font-smoothing: antialiased;
}

/* Global Navigation Header */
.global-header {
    background-color: var(--slds-blue-dark);
    color: #ffffff;
    padding: 10px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.global-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 12px;
}

.global-header .brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 15px;
    white-space: nowrap;
}

.global-header .brand-icon {
    width: 30px;
    height: 30px;
    background: var(--slds-blue-brand);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.global-search {
    flex: 1 1 360px;
    max-width: 450px;
    position: relative;
}

.global-search input {
    width: 100%;
    height: 34px;
    background-color: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 4px;
    padding: 0 12px 0 34px;
    color: #ffffff;
    font-size: 12px;
    outline: none;
    transition: all 0.2s ease;
}

.global-search input::placeholder {
    color: rgba(255, 255, 255, 0.65);
}

.global-search input:focus {
    background-color: #ffffff;
    color: #181818;
}

.global-search input:focus::placeholder {
    color: #888;
}

.global-search .search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.75;
    pointer-events: none;
    display: flex;
}

.global-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.action-btn-icon {
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn-icon:hover {
    background: rgba(255, 255, 255, 0.15);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 6px;
}

.avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--slds-blue-brand);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 11px;
    border: 1.5px solid #ffffff;
    flex-shrink: 0;
}

/* App Main Container */
.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 16px;
}

/* Page Header / Banner */
.page-header {
    background: var(--slds-card-bg);
    border: 1px solid var(--slds-border-color);
    border-radius: var(--slds-border-radius);
    padding: 16px 20px;
    margin-bottom: 16px;
    box-shadow: var(--slds-shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

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

.object-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #0176D3, #0b5c9d);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(1, 118, 211, 0.3);
    flex-shrink: 0;
}

.object-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--slds-text-main);
    line-height: 1.2;
}

.object-subtitle {
    font-size: 12px;
    color: var(--slds-text-subtle);
    margin-top: 2px;
}

.page-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Buttons */
.slds-button {
    height: 36px;
    padding: 0 14px;
    font-size: 12.5px;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid var(--slds-border-color);
    background-color: var(--slds-card-bg);
    color: var(--slds-blue-brand);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.slds-button:hover {
    background-color: var(--slds-blue-light);
    border-color: var(--slds-blue-brand);
}

.slds-button-brand {
    background-color: var(--slds-blue-brand);
    color: #ffffff;
    border-color: var(--slds-blue-brand);
}

.slds-button-brand:hover {
    background-color: var(--slds-blue-hover);
    color: #ffffff;
}

.slds-button-success {
    background-color: #2e7d32;
    color: #ffffff;
    border-color: #2e7d32;
}

.slds-button-success:hover {
    background-color: #1b5e20;
    color: #ffffff;
}

/* Path Progress Bar */
.slds-path {
    margin-bottom: 16px;
}

.slds-path__scroller {
    display: flex;
    background: var(--slds-card-bg);
    border: 1px solid var(--slds-border-color);
    border-radius: var(--slds-border-radius);
    overflow-x: auto;
    box-shadow: var(--slds-shadow);
    -webkit-overflow-scrolling: touch;
}

.slds-path__item {
    flex: 1;
    min-width: 140px;
    padding: 10px 12px;
    text-align: center;
    font-weight: 600;
    font-size: 12px;
    color: var(--slds-text-subtle);
    border-right: 1px solid var(--slds-border-color);
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

.slds-path__item.is-active {
    background: var(--slds-blue-brand);
    color: #ffffff;
}

.slds-path__item.is-complete {
    background: #e8f5e9;
    color: #2e7d32;
}

/* Tabs */
.slds-tabs {
    background: var(--slds-card-bg);
    border: 1px solid var(--slds-border-color);
    border-radius: var(--slds-border-radius);
    box-shadow: var(--slds-shadow);
    margin-bottom: 16px;
}

.slds-tabs__nav {
    display: flex;
    border-bottom: 1px solid var(--slds-border-color);
    list-style: none;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.slds-tabs__item {
    padding: 12px 16px;
    font-weight: 600;
    font-size: 13px;
    color: var(--slds-text-subtle);
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.slds-tabs__item.is-active {
    color: var(--slds-blue-brand);
    border-bottom-color: var(--slds-blue-brand);
}

.tab-content {
    display: none;
    padding: 20px;
}

.tab-content.is-active {
    display: block;
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 16px;
    right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: calc(100vw - 32px);
}

.toast {
    background: #1e293b;
    color: #ffffff;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 12.5px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    border-left: 4px solid var(--slds-blue-brand);
}

/* ==========================================================================
   MOBILE NATIVE APP LAYOUT MEDIA QUERIES (@media <= 640px)
   ========================================================================== */

@media (max-width: 640px) {
    .global-header {
        padding: 8px 12px;
    }

    .global-header-row {
        flex-wrap: wrap;
    }

    .global-search {
        flex: 1 1 100%;
        max-width: 100%;
        order: 2;
        margin-top: 6px;
    }

    .global-search input {
        height: 32px;
        font-size: 11.5px;
    }

    .user-profile span {
        display: none; /* Hide 'admin' text on mobile, keep avatar & signout */
    }

    .app-container {
        padding: 8px;
    }

    .page-header {
        padding: 12px;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .page-header-left {
        width: 100%;
    }

    .object-title {
        font-size: 15px;
    }

    .object-subtitle {
        font-size: 11px;
    }

    .page-header-right {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
    }

    .page-header-right .slds-button {
        width: 100%;
        font-size: 11.5px;
        padding: 0 8px;
        height: 34px;
    }

    .page-header-right > div {
        grid-column: span 2; /* Export dropdown spans full width */
    }

    .page-header-right > div .slds-button {
        width: 100%;
    }

    .tab-content {
        padding: 12px 10px;
    }

    .slds-tabs__item {
        padding: 10px 12px;
        font-size: 12px;
    }

    .slds-path__item {
        min-width: 110px;
        padding: 8px 6px;
        font-size: 11px;
    }
}
