/* =====================================================
   Metronic-Inspired Theme for Bundle Order System
   Created: 2024-11-29
   Based on: Metronic v8+ Design System
   ===================================================== */

/* ===== CSS Variables (Design Tokens) ===== */
:root {
    /* Primary Colors */
    --kt-primary: #009ef7;
    --kt-primary-light: #f1faff;
    --kt-primary-inverse: #ffffff;

    /* Secondary Colors */
    --kt-secondary: #e4e6ef;
    --kt-secondary-active: #3f4254;

    /* Success, Danger, Warning, Info */
    --kt-success: #50cd89;
    --kt-success-light: #e8fff3;
    --kt-danger: #f1416c;
    --kt-danger-light: #fff5f8;
    --kt-warning: #ffc700;
    --kt-warning-light: #fff8dd;
    --kt-info: #7239ea;
    --kt-info-light: #f8f5ff;

    /* Gray Scale */
    --kt-gray-100: #f9f9f9;
    --kt-gray-200: #f4f4f4;
    --kt-gray-300: #e4e6ef;
    --kt-gray-400: #b5b5c3;
    --kt-gray-500: #a1a5b7;
    --kt-gray-600: #7e8299;
    --kt-gray-700: #5e6278;
    --kt-gray-800: #3f4254;
    --kt-gray-900: #181c32;

    /* Dark Colors */
    --kt-dark: #181c32;
    --kt-dark-light: #1e1e2d;

    /* Component Sizes */
    --kt-aside-width: 265px;
    --kt-header-height: 70px;
    --kt-toolbar-height: 55px;

    /* Border Radius */
    --kt-border-radius: 0.625rem;
    --kt-border-radius-sm: 0.425rem;
    --kt-border-radius-lg: 0.875rem;

    /* Shadows */
    --kt-box-shadow-xs: 0 0.1rem 0.75rem 0.25rem rgba(0, 0, 0, 0.05);
    --kt-box-shadow-sm: 0 0.1rem 1rem 0.25rem rgba(0, 0, 0, 0.05);
    --kt-box-shadow: 0 0.5rem 1.5rem 0.5rem rgba(0, 0, 0, 0.075);
    --kt-box-shadow-lg: 0 1rem 2rem 1rem rgba(0, 0, 0, 0.1);

    /* Fonts */
    --kt-font-family: 'Sarabun', 'Inter', Helvetica, sans-serif;
    --kt-font-size-base: 1rem;
}

/* ===== Global Resets ===== */
* {
    outline: none !important;
}

body {
    font-family: var(--kt-font-family);
    font-size: var(--kt-font-size-base);
    color: var(--kt-gray-800);
    background-color: var(--kt-gray-100);
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* ===== Layout Structure ===== */
.kt-wrapper {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* Aside (Sidebar) - LIGHT THEME */
.kt-aside {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--kt-aside-width);
    height: 100vh;
    background: white;
    border-right: 1px solid var(--kt-gray-300);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    box-shadow: var(--kt-box-shadow-sm);
    transition: all 0.3s ease;
}

.kt-aside-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--kt-header-height);
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--kt-gray-300);
    background: linear-gradient(135deg, var(--kt-primary-light) 0%, white 100%);
}

.kt-aside-logo .logo-text {
    color: var(--kt-primary);
    font-size: 1.15rem;
    font-weight: 700;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.kt-aside-menu {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0;
}

/* Custom Scrollbar for Aside */
.kt-aside-menu::-webkit-scrollbar {
    width: 5px;
}

.kt-aside-menu::-webkit-scrollbar-track {
    background: var(--kt-gray-100);
}

.kt-aside-menu::-webkit-scrollbar-thumb {
    background: var(--kt-gray-400);
    border-radius: 10px;
}

.kt-aside-menu::-webkit-scrollbar-thumb:hover {
    background: var(--kt-gray-500);
}

/* Wrapper Container */
.kt-wrapper-container {
    margin-left: var(--kt-aside-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    flex: 1;
    transition: margin-left 0.3s ease;
    overflow-x: hidden;
    width: calc(100vw - var(--kt-aside-width));
    max-width: calc(100vw - var(--kt-aside-width));
}

/* Header */
.kt-header {
    position: sticky;
    top: 0;
    z-index: 95;
    background: white;
    min-height: var(--kt-header-height);
    box-shadow: var(--kt-box-shadow-xs);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

.kt-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* Toolbar (breadcrumb area) */
.kt-toolbar {
    background: white;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--kt-gray-300);
}

.kt-toolbar-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Content Area */
.kt-content {
    flex: 1;
    padding: 2rem;
    background: var(--kt-gray-100);
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

.kt-content-container {
    max-width: 100%;
    overflow-x: hidden;
}

/* ===== Menu Items ===== */
.kt-menu {
    padding: 0;
    margin: 0;
    list-style: none;
}

.kt-menu-item {
    position: relative;
}

.kt-menu-link {
    display: flex;
    align-items: center;
    padding: 0.65rem 1.5rem;
    color: var(--kt-gray-700);
    text-decoration: none;
    transition: all 0.2s ease;
    border-radius: 0;
    font-size: 0.95rem;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.kt-menu-link:hover {
    background: var(--kt-gray-100);
    color: var(--kt-gray-900);
}

.kt-menu-link.active {
    background: var(--kt-primary-light);
    color: var(--kt-primary);
    border-left-color: var(--kt-primary);
    font-weight: 600;
}

.kt-menu-icon {
    margin-right: 0.75rem;
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.kt-menu-title {
    flex: 1;
}

.kt-menu-arrow {
    margin-left: auto;
    font-size: 0.75rem;
    transition: transform 0.2s ease;
}

.kt-menu-arrow.rotate {
    transform: rotate(180deg);
}

/* Sub Menu */
.kt-menu-sub {
    display: none;
    padding: 0;
    margin: 0;
    list-style: none;
}

.kt-menu-sub.show {
    display: block;
}

.kt-menu-sub .kt-menu-link {
    padding-left: 3.5rem;
    font-size: 0.9rem;
    font-weight: 400;
}

/* Menu Section */
.kt-menu-section {
    padding: 1rem 1.5rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--kt-gray-500);
    letter-spacing: 0.5px;
}

/* ===== Cards ===== */
.card {
    background: white;
    border: none;
    border-radius: var(--kt-border-radius);
    box-shadow: var(--kt-box-shadow-xs);
    margin-bottom: 1.5rem;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--kt-gray-300);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--kt-gray-900);
}

.card-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    background: transparent;
    border-top: 1px solid var(--kt-gray-300);
    padding: 1rem 1.5rem;
}

/* ===== Buttons ===== */
.btn {
    border-radius: var(--kt-border-radius-sm);
    font-weight: 600;
    padding: 0.65rem 1.25rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    border: none;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.85rem 1.75rem;
    font-size: 1.05rem;
}

.btn-primary {
    background: var(--kt-primary);
    color: white;
}

.btn-primary:hover {
    background: #0095e8;
    color: white;
    box-shadow: var(--kt-box-shadow-sm);
    transform: translateY(-1px);
}

.btn-light {
    background: var(--kt-gray-200);
    color: var(--kt-gray-800);
}

.btn-light:hover {
    background: var(--kt-gray-300);
    color: var(--kt-gray-900);
}

.btn-success {
    background: var(--kt-success);
    color: white;
}

.btn-success:hover {
    background: #47c380;
    color: white;
}

.btn-danger {
    background: var(--kt-danger);
    color: white;
}

.btn-danger:hover {
    background: #ee3d62;
    color: white;
}

.btn-warning {
    background: var(--kt-warning);
    color: var(--kt-gray-900);
}

.btn-info {
    background: var(--kt-info);
    color: white;
}

/* Icon Buttons */
.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon.btn-sm {
    width: 32px;
    height: 32px;
}

/* ===== Badges ===== */
.badge {
    font-weight: 600;
    padding: 0.4rem 0.65rem;
    border-radius: var(--kt-border-radius-sm);
    font-size: 0.85rem;
}

.badge-primary {
    background: var(--kt-primary-light);
    color: var(--kt-primary);
}

.badge-success {
    background: var(--kt-success-light);
    color: var(--kt-success);
}

.badge-danger {
    background: var(--kt-danger-light);
    color: var(--kt-danger);
}

.badge-warning {
    background: var(--kt-warning-light);
    color: #8b6200;
}

.badge-info {
    background: var(--kt-info-light);
    color: var(--kt-info);
}

/* ===== Tables ===== */
.table {
    color: var(--kt-gray-800);
}

.table thead th {
    background: var(--kt-gray-100);
    color: var(--kt-gray-700);
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 1rem 0.75rem;
    border-bottom: 2px solid var(--kt-gray-300);
}

.table tbody td {
    padding: 1rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--kt-gray-200);
}

.table-hover tbody tr:hover {
    background: var(--kt-gray-100);
}

.table-striped tbody tr:nth-of-type(odd) {
    background: rgba(0, 0, 0, 0.01);
}

.table-rounded {
    border-radius: var(--kt-border-radius);
    overflow: hidden;
}

/* ===== Forms ===== */
.form-label {
    font-weight: 600;
    color: var(--kt-gray-800);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-control,
.form-select {
    border: 1px solid var(--kt-gray-300);
    border-radius: var(--kt-border-radius-sm);
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--kt-primary);
    box-shadow: 0 0 0 0.2rem rgba(0, 158, 247, 0.15);
}

.form-control::placeholder {
    color: var(--kt-gray-400);
}

/* Input Group */
.input-group-text {
    background: var(--kt-gray-100);
    border: 1px solid var(--kt-gray-300);
    color: var(--kt-gray-600);
}

/* ===== Alerts ===== */
.alert {
    border: none;
    border-radius: var(--kt-border-radius);
    padding: 1rem 1.25rem;
    border-left: 4px solid;
}

.alert-primary {
    background: var(--kt-primary-light);
    color: var(--kt-primary);
    border-left-color: var(--kt-primary);
}

.alert-success {
    background: var(--kt-success-light);
    color: var(--kt-success);
    border-left-color: var(--kt-success);
}

.alert-danger {
    background: var(--kt-danger-light);
    color: var(--kt-danger);
    border-left-color: var(--kt-danger);
}

.alert-warning {
    background: var(--kt-warning-light);
    color: #8b6200;
    border-left-color: var(--kt-warning);
}

/* ===== Statistics Cards ===== */
.stats-card {
    background: white;
    border-radius: var(--kt-border-radius);
    padding: 1.5rem;
    box-shadow: var(--kt-box-shadow-xs);
    transition: all 0.2s ease;
}

.stats-card:hover {
    box-shadow: var(--kt-box-shadow-sm);
    transform: translateY(-2px);
}

.stats-card-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--kt-border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.stats-card-icon.icon-primary {
    background: var(--kt-primary-light);
    color: var(--kt-primary);
}

.stats-card-icon.icon-success {
    background: var(--kt-success-light);
    color: var(--kt-success);
}

.stats-card-icon.icon-danger {
    background: var(--kt-danger-light);
    color: var(--kt-danger);
}

.stats-card-icon.icon-warning {
    background: var(--kt-warning-light);
    color: var(--kt-warning);
}

.stats-card-title {
    font-size: 0.9rem;
    color: var(--kt-gray-600);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stats-card-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--kt-gray-900);
}

/* ===== Breadcrumb ===== */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
}

.breadcrumb-item {
    color: var(--kt-gray-600);
    font-size: 0.9rem;
}

.breadcrumb-item.active {
    color: var(--kt-gray-800);
    font-weight: 600;
}

/* ===== User Menu (Header) ===== */
.kt-user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: var(--kt-border-radius);
    background: var(--kt-gray-100);
    cursor: pointer;
    transition: all 0.2s ease;
}

.kt-user-menu:hover {
    background: var(--kt-gray-200);
}

.kt-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--kt-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.kt-user-info {
    display: flex;
    flex-direction: column;
}

.kt-user-name {
    font-weight: 600;
    color: var(--kt-gray-900);
    font-size: 0.9rem;
}

.kt-user-role {
    font-size: 0.75rem;
    color: var(--kt-gray-600);
}

/* ===== Modals ===== */
.modal-content {
    border: none;
    border-radius: var(--kt-border-radius);
    box-shadow: var(--kt-box-shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--kt-gray-300);
    padding: 1.5rem;
}

.modal-title {
    font-weight: 700;
    color: var(--kt-gray-900);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid var(--kt-gray-300);
    padding: 1rem 1.5rem;
}

/* ===== Responsive ===== */
@media (max-width: 991.98px) {
    .kt-aside {
        transform: translateX(-100%);
    }

    .kt-aside.show {
        transform: translateX(0);
    }

    .kt-wrapper-container {
        margin-left: 0;
        width: 100vw;
        max-width: 100vw;
    }

    .kt-header {
        padding: 0 1rem;
    }

    .kt-content {
        padding: 1rem;
    }

    .kt-toolbar {
        padding: 0.75rem 1rem;
    }
}

/* Mobile Toggle Button */
.kt-aside-toggle {
    display: none;
    width: 40px;
    height: 40px;
    border-radius: var(--kt-border-radius-sm);
    background: var(--kt-gray-100);
    border: none;
    color: var(--kt-gray-700);
    cursor: pointer;
}

@media (max-width: 991.98px) {
    .kt-aside-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

/* ===== Utilities ===== */
.kt-separator {
    height: 1px;
    background: var(--kt-gray-300);
    margin: 1rem 0;
}

.kt-separator-dashed {
    border-top: 1px dashed var(--kt-gray-300);
    margin: 1rem 0;
}

.text-muted {
    color: var(--kt-gray-600) !important;
}

.text-dark {
    color: var(--kt-gray-900) !important;
}

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

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

/* ===== Page Title ===== */
.kt-page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--kt-gray-900);
    margin-bottom: 0;
}

/* ===== Footer ===== */
.kt-footer {
    background: white;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--kt-gray-300);
    margin-top: auto;
}

.kt-footer-text {
    color: var(--kt-gray-600);
    font-size: 0.875rem;
}

/* ===== Aside Footer (User info in sidebar) ===== */
.kt-aside-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--kt-gray-300);
    background: var(--kt-gray-100);
}

.kt-aside-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: white;
    border-radius: var(--kt-border-radius);
    border: 1px solid var(--kt-gray-300);
}

.kt-aside-user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--kt-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

.kt-aside-user-info {
    flex: 1;
    min-width: 0;
}

.kt-aside-user-name {
    color: var(--kt-gray-900);
    font-weight: 600;
    font-size: 0.9rem;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.kt-aside-user-role {
    color: var(--kt-gray-600);
    font-size: 0.75rem;
}

/* ===== Print Styles ===== */
@media print {
    .kt-aside,
    .kt-header,
    .kt-toolbar,
    .kt-footer,
    .btn,
    .card-toolbar {
        display: none !important;
    }

    .kt-wrapper-container {
        margin-left: 0;
    }

    .kt-content {
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid var(--kt-gray-300);
    }
}

/* ===== Scrollbar Styling ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--kt-gray-200);
}

::-webkit-scrollbar-thumb {
    background: var(--kt-gray-400);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--kt-gray-500);
}
