/* --- CSS Variables (Design Tokens) --- */
:root {
    --primary: #0284C7;
    --primary-hover: #0369A1;
    --background-light: #F0F9FF;
    --sidebar-bg: #0C4A6E;
    --main-text: #082F49;
    --border-color: #BAE6FD;

    --white: #ffffff;
    --sky-50: #f0f9ff;
    --sky-100: #e0f2fe;
    --sky-200: #bae6fd;
    --sky-800: #075985;
    --sky-900: #0c4a6e;
    --sky-950: #082f49;
}

/* --- Reset & Base Styles --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background-light);
    color: var(--main-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
    font-family: inherit;
}

input,
select,
textarea {
    font-family: inherit;
}

.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.icon-fill {
    font-variation-settings: 'FILL' 1;
}

.icon-sm {
    font-size: 20px;
}

.icon-xs {
    font-size: 16px;
}

/* --- Header --- */
.site-header {
    height: 64px;
    background-color: var(--white);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 30;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.menu-btn,
.logout-btn {
    color: var(--primary);
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
}

.menu-btn:hover,
.logout-btn:hover {
    color: var(--primary-hover);
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background-color: var(--primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    flex-shrink: 0;
}

.logo-text {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--main-text);
}

#orders-submenu-chevron {
    transition: transform 0.3s ease;
}

.rotate {
    transform: rotate(180deg);
}

/* --- Main Layout --- */
.app-layout {
    display: flex;
    height: calc(100vh - 64px);
    overflow: visible;
    position: relative;
}


.sidebar {
    width: 288px;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: margin-left 0.3s ease-in-out, transform 0.3s ease-in-out;
    z-index: 40;
    margin-left: 0;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(8, 47, 73, 0.5);
    z-index: 35;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.sidebar-nav {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: rgba(224, 242, 254, 0.7);
    border-radius: 8px;
    transition: background-color 0.2s, color 0.2s;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
    font-weight: 600;
}

/* --- SUB MENU STYLES --- */
.nav-btn {
    width: 100%;
    justify-content: space-between;
}

.nav-btn-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chevron {
    transition: transform 0.3s ease;
}

.chevron.rotate {
    transform: rotate(180deg);
}

.sub-menu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
    padding-left: 44px;
    gap: 4px;
}

.sub-menu.open {
    max-height: 300px;
    margin-bottom: 8px;
}

.sub-nav-item {
    padding: 8px 12px;
    color: rgba(224, 242, 254, 0.6);
    font-size: 13px;
    border-radius: 6px;
    transition: background-color 0.2s, color 0.2s;
}

.sub-nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--white);
}


.sub-nav-item.active-sub {
    color: var(--white);
    font-weight: 600;
}

/* ---------------------------- */

/* --- Main Content Area --- */
.main-content {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    width: 100%;
    transition: width 0.3s ease-in-out;
}

.breadcrumbs {
    padding: 32px 32px 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 14px;
    color: rgba(7, 89, 133, 0.6);
}

.breadcrumbs a {
    transition: color 0.2s;
}

.breadcrumbs a:hover {
    color: var(--primary);
}

.breadcrumbs .current {
    color: var(--main-text);
    font-weight: 500;
}

.content-container {
    padding: 32px;
    margin: 0 auto;
    width: 100%;
    transition: all 0.3s ease-in-out;
}

.page-header {
    margin-bottom: 32px;
}

.page-title {
    font-size: 30px;
    font-weight: 800;
    color: var(--main-text);
    letter-spacing: -0.025em;
    line-height: 1.2;
}

.page-subtitle {
    color: rgba(7, 89, 133, 0.7);
    margin-top: 8px;
    line-height: 1.5;
}

/* --- Form Card --- */
.card {
    background-color: var(--white);
    border-radius: 8px;
    box-shadow: 0 20px 25px -5px rgba(12, 74, 110, 0.05), 0 8px 10px -6px rgba(12, 74, 110, 0.05);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.card-body {
    padding: 32px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 24px;
}

.section-header .material-symbols-outlined {
    color: var(--primary);
}

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--main-text);
}

/* Grids */
.grid-2-col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.grid-product {
    display: grid;
    grid-template-columns: 3fr 3fr 3fr;
    gap: 24px;
}

/* Form Controls */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.col-span-full {
    grid-column: 1 / -1;
}

.form-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--sky-900);
}

.form-input {
    width: 100%;
    border-radius: 5px;
    border: 1px solid var(--border-color);
    background-color: var(--sky-50);
    color: var(--main-text);
    padding: 10px 12px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(2, 132, 199, 0.2);
}

textarea.form-input {
    resize: vertical;
}

/* Custom Radio Buttons */
.radio-group {
    display: flex;
    gap: 16px;
    padding: 8px;
    background-color: var(--sky-50);
    border-radius: 8px;
}

.radio-label {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: 5px;
    background-color: var(--white);
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: all 0.2s;
}

.radio-label:has(input:checked) {
    border-color: var(--primary);
    color: var(--primary);
}

.radio-label input {
    accent-color: var(--primary);
}

.radio-text {
    font-size: 14px;
    font-weight: 500;
}

.divider {
    border: none;
    border-top: 1px solid var(--sky-100);
    margin: 0;
}

/* Product Input specifics */
.input-with-icon {
    position: relative;
}

.hide-input-wheel::-webkit-inner-spin-button,
.hide-input-wheel::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.hide-input-wheel {
    -moz-appearance: textfield; 
}

.currency-symbol {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(7, 89, 133, 0.4);
}

.form-input.pl-8 {
    padding-left: 32px;
    font-family: monospace;
}

/* --- Summary Area --- */
.summary-actions {
    display: flex;
    gap: 16px;
    width: auto;
}

.btn {
    padding: 12px 24px;
    font-weight: 700;
    border-radius: 8px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 16px;
}

.btn-secondary {
    background-color: #2675a8;
    color: #ffffff;
    border: 1px solid var(--border-color);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
    background-color: #1c5479;
}

/* 
           RESPONSIVE MEDIA QUERIES
            */
@media (min-width: 1025px) {
    .sidebar.collapsed {
        margin-left: -288px;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        top: 64px;
        bottom: 0;
        left: 0;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block;
        top: 64px;
    }

    .sidebar-overlay.open {
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-overlay:not(.open) {
        pointer-events: none;
    }
}

@media (max-width: 768px) {
    .site-header {
        padding: 0 16px;
    }

    .header-right .logout-btn span {
        margin-right: -4px;
    }

    .header-right .logout-text {
        display: none;
    }

    .breadcrumbs {
        padding: 24px 16px 0;
    }

    .content-container {
        padding: 24px 16px;
    }

    .card-body {
        padding: 20px;
        gap: 24px;
    }

    .page-title {
        font-size: 24px;
    }

    .grid-2-col,
    .grid-product {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .radio-group {
        flex-direction: column;
        gap: 8px;
    }

    .summary-actions {
        flex-direction: column;
        width: 100%;
        gap: 12px;
    }

    .btn {
        width: 100%;
    }
}