/* ============================================
   DAIM PAK CRM & Manufacturing Operations System
   Custom Stylesheet - Industrial Theme
   ============================================ */

/* Root Variables - Industrial Color Scheme */
:root {
    --primary-blue: #1e3a5f;
    --secondary-blue: #2c5282;
    --accent-blue: #3182ce;
    --light-blue: #ebf8ff;
    --dark-grey: #2d3748;
    --medium-grey: #4a5568;
    --light-grey: #e2e8f0;
    --bg-grey: #f7fafc;
    --white: #ffffff;
    --success-green: #38a169;
    --warning-orange: #dd6b20;
    --danger-red: #e53e3e;
    --info-cyan: #00b5d8;
    --sidebar-width: 260px;
    --header-height: 60px;
    --transition-speed: 0.3s;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-grey);
    color: var(--dark-grey);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================
   LAYOUT - Main Structure
   ============================================ */
.wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-left var(--transition-speed) ease;
}

.content-wrapper {
    flex: 1;
    padding: 25px;
    margin-top: var(--header-height);
}

/* ============================================
   SIDEBAR STYLES
   ============================================ */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--primary-blue) 0%, var(--secondary-blue) 100%);
    z-index: 1000;
    overflow-y: auto;
    transition: transform var(--transition-speed) ease;
    box-shadow: 4px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.1);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.sidebar-logo img {
    width: 45px;
    height: 45px;
    border-radius: 8px;
}

.sidebar-logo h4 {
    color: var(--white);
    font-weight: 700;
    font-size: 1.25rem;
    margin: 0;
    letter-spacing: 1px;
}

.sidebar-logo small {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.7rem;
    display: block;
    margin-top: 3px;
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 15px 0;
}

.nav-section {
    margin-bottom: 10px;
}

.nav-section-title {
    padding: 10px 20px;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all var(--transition-speed) ease;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border-left-color: var(--accent-blue);
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
    border-left-color: var(--white);
}

.nav-link i {
    width: 22px;
    margin-right: 12px;
    font-size: 1rem;
    text-align: center;
}

.nav-link .badge {
    margin-left: auto;
    font-size: 0.7rem;
    padding: 3px 8px;
}

/* Submenu */
.nav-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    background: rgba(0, 0, 0, 0.15);
    display: none;
}

.nav-submenu.show {
    display: block;
}

.nav-submenu .nav-link {
    padding-left: 54px;
    font-size: 0.85rem;
}

.nav-link[data-bs-toggle="collapse"]::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-left: auto;
    font-size: 0.7rem;
    transition: transform var(--transition-speed) ease;
}

.nav-link[data-bs-toggle="collapse"][aria-expanded="true"]::after {
    transform: rotate(180deg);
}

/* ============================================
   HEADER/NAVBAR STYLES
   ============================================ */
.top-navbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: var(--white);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 25px;
    transition: left var(--transition-speed) ease;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--dark-grey);
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all var(--transition-speed) ease;
}

.sidebar-toggle:hover {
    background: var(--light-grey);
    color: var(--primary-blue);
}

.search-box {
    position: relative;
}

.search-box input {
    width: 300px;
    padding: 10px 15px 10px 40px;
    border: 1px solid var(--light-grey);
    border-radius: 8px;
    font-size: 0.9rem;
    background: var(--bg-grey);
    transition: all var(--transition-speed) ease;
}

.search-box input:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: var(--white);
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.search-box i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--medium-grey);
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.navbar-icon {
    position: relative;
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--medium-grey);
    cursor: pointer;
    padding: 10px;
    border-radius: 50%;
    transition: all var(--transition-speed) ease;
}

.navbar-icon:hover {
    background: var(--light-grey);
    color: var(--primary-blue);
}

.navbar-icon .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.6rem;
    padding: 2px 5px;
}

.user-dropdown {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 8px;
    transition: all var(--transition-speed) ease;
}

.user-dropdown:hover {
    background: var(--light-grey);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-blue), var(--accent-blue));
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-weight: 600;
    font-size: 0.9rem;
}

.user-info {
    text-align: left;
}

.user-info .name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--dark-grey);
}

.user-info .role {
    font-size: 0.75rem;
    color: var(--medium-grey);
}

/* ============================================
   DASHBOARD CARDS & COMPONENTS
   ============================================ */
.page-header {
    margin-bottom: 25px;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-grey);
    margin-bottom: 5px;
}

.breadcrumb {
    background: none;
    padding: 0;
    margin: 0;
    font-size: 0.85rem;
}

.breadcrumb-item a {
    color: var(--medium-grey);
    text-decoration: none;
}

.breadcrumb-item.active {
    color: var(--accent-blue);
}

/* KPI Cards */
.kpi-card {
    background: var(--white);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    transition: all var(--transition-speed) ease;
    border: 1px solid var(--light-grey);
    height: 100%;
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.kpi-card .icon-box {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    margin-bottom: 15px;
}

.kpi-card .icon-box.blue {
    background: rgba(49, 130, 206, 0.1);
    color: var(--accent-blue);
}

.kpi-card .icon-box.green {
    background: rgba(56, 161, 105, 0.1);
    color: var(--success-green);
}

.kpi-card .icon-box.orange {
    background: rgba(221, 107, 32, 0.1);
    color: var(--warning-orange);
}

.kpi-card .icon-box.red {
    background: rgba(229, 62, 62, 0.1);
    color: var(--danger-red);
}

.kpi-card .icon-box.cyan {
    background: rgba(0, 181, 216, 0.1);
    color: var(--info-cyan);
}

.kpi-card .kpi-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark-grey);
    line-height: 1;
}

.kpi-card .kpi-label {
    font-size: 0.85rem;
    color: var(--medium-grey);
    margin-top: 5px;
}

.kpi-card .kpi-change {
    font-size: 0.8rem;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.kpi-card .kpi-change.positive {
    color: var(--success-green);
}

.kpi-card .kpi-change.negative {
    color: var(--danger-red);
}

/* Data Cards */
.data-card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--light-grey);
    overflow: hidden;
}

.data-card .card-header {
    background: var(--white);
    border-bottom: 1px solid var(--light-grey);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.data-card .card-header h5 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--dark-grey);
    margin: 0;
}

.data-card .card-body {
    padding: 20px;
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--light-grey);
    overflow: hidden;
}

.custom-table {
    width: 100%;
    margin-bottom: 0;
}

.custom-table thead {
    background: var(--bg-grey);
}

.custom-table thead th {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--dark-grey);
    padding: 15px;
    border-bottom: 2px solid var(--light-grey);
    white-space: nowrap;
}

.custom-table tbody td {
    padding: 15px;
    font-size: 0.9rem;
    color: var(--medium-grey);
    border-bottom: 1px solid var(--light-grey);
    vertical-align: middle;
}

.custom-table tbody tr:hover {
    background: var(--bg-grey);
}

.custom-table tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================
   FORMS
   ============================================ */
.form-card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--light-grey);
}

.form-card .card-header {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    color: var(--white);
    padding: 15px 20px;
    border-radius: 12px 12px 0 0;
}

.form-card .card-header h5 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.form-card .card-body {
    padding: 25px;
}

.form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--dark-grey);
    margin-bottom: 6px;
}

.form-control, .form-select {
    border: 1px solid var(--light-grey);
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 0.9rem;
    transition: all var(--transition-speed) ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.1);
}

.form-control::placeholder {
    color: #a0aec0;
}

.input-group-text {
    background: var(--bg-grey);
    border: 1px solid var(--light-grey);
    color: var(--medium-grey);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 8px;
    transition: all var(--transition-speed) ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--secondary-blue), var(--primary-blue));
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(30, 58, 95, 0.3);
}

.btn-success {
    background: var(--success-green);
    border: none;
}

.btn-success:hover {
    background: #2f8a5b;
    transform: translateY(-2px);
}

.btn-outline-primary {
    color: var(--primary-blue);
    border: 2px solid var(--primary-blue);
}

.btn-outline-primary:hover {
    background: var(--primary-blue);
    color: var(--white);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
}

.btn-icon {
    width: 35px;
    height: 35px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

/* ============================================
   STATUS BADGES
   ============================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.active {
    background: rgba(56, 161, 105, 0.1);
    color: var(--success-green);
}

.status-badge.pending {
    background: rgba(221, 107, 32, 0.1);
    color: var(--warning-orange);
}

.status-badge.inactive {
    background: rgba(229, 62, 62, 0.1);
    color: var(--danger-red);
}

.status-badge.info {
    background: rgba(0, 181, 216, 0.1);
    color: var(--info-cyan);
}

/* ============================================
   ORDER STATUS FLOW
   ============================================ */
.order-flow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    overflow-x: auto;
}

.flow-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    flex: 1;
    min-width: 100px;
}

.flow-step:not(:last-child)::after {
    content: '';
    position: absolute;
    top: 20px;
    left: 50%;
    width: 100%;
    height: 3px;
    background: var(--light-grey);
    z-index: 1;
}

.flow-step.completed:not(:last-child)::after {
    background: var(--success-green);
}

.flow-step .step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--light-grey);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--medium-grey);
    z-index: 2;
    transition: all var(--transition-speed) ease;
}

.flow-step.completed .step-circle {
    background: var(--success-green);
    color: var(--white);
}

.flow-step.current .step-circle {
    background: var(--accent-blue);
    color: var(--white);
    box-shadow: 0 0 0 4px rgba(49, 130, 206, 0.2);
}

.flow-step .step-label {
    margin-top: 10px;
    font-size: 0.7rem;
    text-align: center;
    color: var(--medium-grey);
    font-weight: 500;
}

.flow-step.completed .step-label,
.flow-step.current .step-label {
    color: var(--dark-grey);
    font-weight: 600;
}

/* ============================================
   CHARTS
   ============================================ */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* ============================================
   ALERTS & NOTIFICATIONS
   ============================================ */
.alert-card {
    border-radius: 10px;
    border: none;
    padding: 15px 20px;
}

.alert-card.alert-warning {
    background: rgba(221, 107, 32, 0.1);
    border-left: 4px solid var(--warning-orange);
}

.alert-card.alert-danger {
    background: rgba(229, 62, 62, 0.1);
    border-left: 4px solid var(--danger-red);
}

.alert-card.alert-success {
    background: rgba(56, 161, 105, 0.1);
    border-left: 4px solid var(--success-green);
}

/* ============================================
   MODAL STYLES
   ============================================ */
.modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    color: var(--white);
    border-radius: 12px 12px 0 0;
    padding: 15px 20px;
}

.modal-header .btn-close {
    filter: invert(1);
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    border-top: 1px solid var(--light-grey);
    padding: 15px 20px;
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .top-navbar {
        left: 0;
    }

    .search-box input {
        width: 200px;
    }
}

@media (max-width: 768px) {
    .content-wrapper {
        padding: 15px;
    }

    .search-box {
        display: none;
    }

    .user-info {
        display: none;
    }

    .kpi-card {
        margin-bottom: 15px;
    }

    .order-flow {
        flex-direction: column;
        gap: 10px;
    }

    .flow-step:not(:last-child)::after {
        display: none;
    }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-primary-blue {
    color: var(--primary-blue) !important;
}

.text-accent-blue {
    color: var(--accent-blue) !important;
}

.bg-primary-blue {
    background: var(--primary-blue) !important;
}

.bg-accent-blue {
    background: var(--accent-blue) !important;
}

.rounded-lg {
    border-radius: 12px !important;
}

.shadow-sm {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05) !important;
}

.shadow-md {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1) !important;
}

/* Animation Keyframes */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-grey);
}

::-webkit-scrollbar-thumb {
    background: var(--light-grey);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--medium-grey);
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
    color: var(--primary-blue);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
}

.toast {
    border: none;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.toast.bg-success {
    background: var(--success-green) !important;
}

.toast.bg-danger {
    background: var(--danger-red) !important;
}

/* Print Styles */
@media print {
    .sidebar,
    .top-navbar,
    .btn,
    .no-print {
        display: none !important;
    }

    .main-content {
        margin-left: 0;
    }

    .content-wrapper {
        margin-top: 0;
    }
}
