/* =========================================================
   AP / SAARNA CMS
   GLOBAL METRO UI THEME
   ========================================================= */

:root {
    --cms-red: #d71920;
    --cms-red-dark: #a81016;
    --cms-green: #169b62;
    --cms-green-dark: #08794a;
    --cms-blue: #135fb3;
    --cms-blue-dark: #0b407d;
    --cms-orange: #f28c28;
    --cms-purple: #6f42c1;
    --cms-cyan: #0b9fb3;
    --cms-bg: #f3f6fa;
    --cms-surface: #ffffff;
    --cms-surface-soft: #f8fafc;
    --cms-border: #e3e8ef;
    --cms-text: #172033;
    --cms-text-muted: #697386;
    --cms-text-light: #ffffff;
    --cms-header-height: 78px;
    --cms-nav-height: 102px;
    --cms-radius-sm: 8px;
    --cms-radius-md: 14px;
    --cms-radius-lg: 20px;
    --cms-shadow-sm: 0 4px 14px rgba(25, 35, 55, 0.06);
    --cms-shadow-md: 0 10px 30px rgba(25, 35, 55, 0.10);
    --cms-shadow-lg: 0 18px 50px rgba(25, 35, 55, 0.14);
}


/* =========================================================
   BASE
   ========================================================= */

html {
    position: relative;
    min-height: 100%;
    font-size: 14px;
}

body.cms-body {
    min-height: 100vh;
    margin: 0;
    background: radial-gradient( circle at top right, rgba(19, 95, 179, 0.05), transparent 28% ), var(--cms-bg);
    color: var(--cms-text);
    font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

a {
    text-decoration: none;
}

button,
input,
select,
textarea {
    font-family: inherit;
}


/* =========================================================
   TOP HEADER
   ========================================================= */

.cms-top-header {
    position: sticky;
    top: 0;
    z-index: 1050;
    min-height: var(--cms-header-height);
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(180px, auto) minmax(300px, 1fr);
    align-items: center;
    gap: 20px;
    padding: 12px 26px;
    color: var(--cms-text-light);
    background: linear-gradient( 120deg, #a70d14 0%, #d71920 42%, #ee3b42 100% );
    box-shadow: 0 6px 24px rgba(112, 8, 13, 0.24);
}

.cms-brand-section {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 14px;
}

.cms-brand {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    gap: 13px;
    color: #ffffff;
}

    .cms-brand:hover {
        color: #ffffff;
    }

.cms-brand-mark {
    width: 50px;
    height: 50px;
    flex: 0 0 50px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    background: linear-gradient( 145deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0.08) );
    color: #ffffff;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -0.5px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 7px 18px rgba(94, 5, 9, 0.18);
}

.cms-brand-text {
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.cms-brand-main {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 21px;
    font-weight: 900;
    letter-spacing: 0.4px;
}

.cms-brand-subtitle {
    margin-top: 7px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: rgba(255, 255, 255, 0.78);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 2px;
}

.cms-header-center {
    display: flex;
    justify-content: center;
}

.cms-system-status {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 9px 14px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.10);
    color: rgba(255, 255, 255, 0.92);
    font-size: 12px;
    font-weight: 700;
    backdrop-filter: blur(8px);
}

.cms-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #73f0a7;
    box-shadow: 0 0 0 4px rgba(115, 240, 167, 0.15), 0 0 12px rgba(115, 240, 167, 0.8);
}

.cms-user-section {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
}

.cms-user-info {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cms-user-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.66);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    font-size: 16px;
    font-weight: 900;
}

.cms-user-details {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.cms-user-label {
    color: rgba(255, 255, 255, 0.70);
    font-size: 10px;
    font-weight: 600;
}

.cms-user-name {
    max-width: 170px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
}

.cms-logout-form {
    margin: 0;
}

.cms-logout-button,
.cms-login-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 15px;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 11px;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 12px;
    font-weight: 800;
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

    .cms-logout-button:hover,
    .cms-login-button:hover {
        transform: translateY(-1px);
        background: #ffffff;
        color: var(--cms-red-dark);
        box-shadow: 0 8px 20px rgba(83, 4, 8, 0.2);
    }

.cms-logout-icon {
    font-size: 18px;
    line-height: 1;
}

.cms-mobile-menu {
    display: none;
    width: 42px;
    height: 42px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
}

    .cms-mobile-menu span {
        width: 20px;
        height: 2px;
        display: block;
        margin: 4px auto;
        border-radius: 2px;
        background: #ffffff;
    }


/* =========================================================
   MODULE NAVIGATION
   ========================================================= */

.cms-module-navigation {
    position: sticky;
    top: var(--cms-header-height);
    z-index: 1040;
    padding: 12px 18px;
    border-bottom: 1px solid var(--cms-border);
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 5px 18px rgba(31, 43, 67, 0.07);
    backdrop-filter: blur(12px);
}

.cms-module-scroll {
    display: flex;
    align-items: stretch;
    gap: 10px;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 2px 7px;
    scrollbar-width: thin;
    scrollbar-color: #c9d1dc transparent;
}

    .cms-module-scroll::-webkit-scrollbar {
        height: 6px;
    }

    .cms-module-scroll::-webkit-scrollbar-track {
        background: transparent;
    }

    .cms-module-scroll::-webkit-scrollbar-thumb {
        border-radius: 20px;
        background: #c9d1dc;
    }

.cms-module-tab {
    min-width: 185px;
    min-height: 72px;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 13px;
    border: 1px solid var(--cms-border);
    border-radius: var(--cms-radius-md);
    background: var(--cms-surface);
    color: var(--cms-text);
    box-shadow: var(--cms-shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

    .cms-module-tab:hover {
        transform: translateY(-3px);
        border-color: rgba(215, 25, 32, 0.28);
        background: #ffffff;
        color: var(--cms-text);
        box-shadow: var(--cms-shadow-md);
    }

    .cms-module-tab.active {
        border-color: transparent;
        background: linear-gradient( 125deg, #b90f16 0%, #d71920 55%, #ec3f46 100% );
        color: #ffffff;
        box-shadow: 0 12px 28px rgba(190, 16, 23, 0.24);
    }

.cms-tab-icon {
    width: 43px;
    height: 43px;
    flex: 0 0 43px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    color: #ffffff;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: -0.2px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.cms-module-tab.active .cms-tab-icon {
    border: 1px solid rgba(255, 255, 255, 0.32);
    background: rgba(255, 255, 255, 0.18);
}

.tab-ap {
    background: linear-gradient(145deg, #07589f, #1681d4);
}

.tab-saarna {
    background: linear-gradient(145deg, #087b4b, #1ab874);
}

.tab-retail {
    background: linear-gradient(145deg, #d71920, #ff4a51);
}

.tab-distributor {
    background: linear-gradient(145deg, #6f42c1, #9567e6);
}

.tab-inventory {
    background: linear-gradient(145deg, #d46d00, #f29b35);
}

.tab-products {
    background: linear-gradient(145deg, #087f8f, #11b7cb);
}

.tab-price {
    background: linear-gradient(145deg, #18734b, #27ad73);
}

.tab-customer {
    background: linear-gradient(145deg, #344968, #5c7394);
}

.tab-transfer {
    background: linear-gradient(145deg, #7b3d00, #bf6c15);
}
.tab-Invoices {
    background: linear-gradient(145deg, #e67f16, #dde31dcc);
}
.tab-analysis {
    background: linear-gradient(145deg, #3f2d91, #7157d8);
}
.tab-import{
    background: linear-gradient(145deg, #e81666, #f69ce0);
}
.cms-tab-content {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.cms-tab-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 900;
}

.cms-tab-description {
    margin-top: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--cms-text-muted);
    font-size: 10px;
    font-weight: 600;
}

.cms-module-tab.active .cms-tab-description {
    color: rgba(255, 255, 255, 0.75);
}


/* =========================================================
   PAGE HEADING
   ========================================================= */

.cms-page-heading {
    padding: 24px 28px 0;
}

.cms-page-heading-content {
    min-height: 92px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 20px 24px;
    border: 1px solid rgba(225, 231, 239, 0.92);
    border-radius: var(--cms-radius-lg);
    background: linear-gradient( 135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 253, 0.96) );
    box-shadow: var(--cms-shadow-sm);
}

.cms-breadcrumb {
    margin-bottom: 8px;
    color: var(--cms-text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}

    .cms-breadcrumb span {
        margin: 0 7px;
        color: var(--cms-red);
    }

.cms-page-title {
    margin: 0;
    color: var(--cms-text);
    font-size: 25px;
    font-weight: 900;
    letter-spacing: -0.6px;
}

.cms-page-description {
    margin: 8px 0 0;
    color: var(--cms-text-muted);
    font-size: 13px;
}

.cms-page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}


/* =========================================================
   MAIN CONTENT
   ========================================================= */

.cms-main-content {
    width: 100%;
    padding: 22px 28px 40px;
}


/* =========================================================
   COMMON MODERN PANEL
   Use this class in forms and DataTables pages
   ========================================================= */

.cms-panel {
    border: 1px solid var(--cms-border);
    border-radius: var(--cms-radius-lg);
    background: var(--cms-surface);
    box-shadow: var(--cms-shadow-sm);
}

.cms-panel-header {
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--cms-border);
}

.cms-panel-title {
    margin: 0;
    font-size: 16px;
    font-weight: 900;
}

.cms-panel-subtitle {
    margin: 4px 0 0;
    color: var(--cms-text-muted);
    font-size: 12px;
}

.cms-panel-body {
    padding: 20px;
}


/* =========================================================
   COMMON BUTTONS
   ========================================================= */

.btn-cms-primary {
    border: 0;
    border-radius: 10px;
    padding: 10px 18px;
    background: linear-gradient( 135deg, var(--cms-red-dark), var(--cms-red) );
    color: #ffffff;
    font-size: 13px;
    font-weight: 800;
    box-shadow: 0 8px 20px rgba(215, 25, 32, 0.20);
}

    .btn-cms-primary:hover {
        color: #ffffff;
        transform: translateY(-1px);
    }

.btn-cms-secondary {
    border: 1px solid var(--cms-border);
    border-radius: 10px;
    padding: 10px 18px;
    background: #ffffff;
    color: var(--cms-text);
    font-size: 13px;
    font-weight: 800;
}

    .btn-cms-secondary:hover {
        border-color: #bfc8d5;
        background: var(--cms-surface-soft);
    }


/* =========================================================
   FORM CONTROLS
   ========================================================= */

.cms-form-label {
    margin-bottom: 7px;
    color: #344054;
    font-size: 12px;
    font-weight: 800;
}

.cms-form-control,
.cms-form-select {
    min-height: 44px;
    border: 1px solid #d8dee8;
    border-radius: 10px;
    background-color: #ffffff;
    font-size: 13px;
    box-shadow: none;
}

    .cms-form-control:focus,
    .cms-form-select:focus {
        border-color: rgba(215, 25, 32, 0.55);
        box-shadow: 0 0 0 4px rgba(215, 25, 32, 0.09);
    }


/* =========================================================
   DATATABLE / TABLE DESIGN
   ========================================================= */

.cms-table-wrapper {
    overflow: hidden;
    border: 1px solid var(--cms-border);
    border-radius: var(--cms-radius-md);
    background: #ffffff;
}

.cms-table {
    width: 100%;
    margin: 0;
}

    .cms-table thead th {
        padding: 14px 15px;
        border-bottom: 1px solid var(--cms-border);
        background: #f5f7fa;
        color: #465266;
        font-size: 11px;
        font-weight: 900;
        letter-spacing: 0.35px;
        text-transform: uppercase;
    }

    .cms-table tbody td {
        padding: 14px 15px;
        border-bottom: 1px solid #edf0f4;
        color: #344054;
        font-size: 13px;
        vertical-align: middle;
    }

    .cms-table tbody tr:hover {
        background: #fff8f8;
    }


/* =========================================================
   FOOTER
   ========================================================= */

.cms-footer {
    padding: 0 28px 24px;
}

.cms-footer-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-top: 1px solid var(--cms-border);
    color: var(--cms-text-muted);
    font-size: 11px;
}

.cms-footer-system {
    font-weight: 700;
}


/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1100px) {

    .cms-top-header {
        grid-template-columns: minmax(240px, 1fr) minmax(280px, auto);
    }

    .cms-header-center {
        display: none;
    }

    .cms-user-details {
        display: none;
    }
}

@media (max-width: 768px) {

    :root {
        --cms-header-height: 68px;
    }

    .cms-top-header {
        grid-template-columns: 1fr auto;
        gap: 10px;
        min-height: var(--cms-header-height);
        padding: 10px 14px;
    }

    .cms-mobile-menu {
        display: inline-block;
    }

    .cms-brand-mark {
        width: 42px;
        height: 42px;
        flex-basis: 42px;
        border-radius: 12px;
        font-size: 15px;
    }

    .cms-brand-main {
        font-size: 16px;
    }

    .cms-brand-subtitle {
        display: none;
    }

    .cms-user-info {
        display: none;
    }

    .cms-logout-button {
        padding: 9px 11px;
    }

        .cms-logout-button span:last-child {
            display: none;
        }

    .cms-module-navigation {
        top: var(--cms-header-height);
        padding: 10px;
    }

    .cms-module-tab {
        min-width: 165px;
        min-height: 66px;
    }

    .cms-page-heading {
        padding: 16px 14px 0;
    }

    .cms-page-heading-content {
        align-items: flex-start;
        flex-direction: column;
        padding: 17px;
    }

    .cms-page-title {
        font-size: 21px;
    }

    .cms-page-actions {
        width: 100%;
    }

    .cms-main-content {
        padding: 16px 14px 30px;
    }

    .cms-footer {
        padding: 0 14px 18px;
    }

    .cms-footer-inner {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 480px) {

    .cms-brand-text {
        display: none;
    }

    .cms-module-tab {
        min-width: 148px;
    }

    .cms-tab-description {
        display: none;
    }
}
