/* ==========================================================================
   MSHAVE Dashboard - Midtsjaellands Havemaskiner ApS
   Colors sourced from www.mshavemaskiner.dk
   ========================================================================== */

:root {
    --mshave-dark: #282c33;
    --mshave-orange: #f07d1a;
    --mshave-orange-hover: #d96a0e;
    --mshave-green: #5eb75d;
    --mshave-green-hover: #4ea34d;
    --mshave-text: #606060;
    --mshave-text-light: #6c6c6c;
    --mshave-link-hover: #222;
    --mshave-border: #eaedef;
    --mshave-bg: #f4f6f9;
    --mshave-white: #ffffff;
    --sidebar-width: 260px;
    --sidebar-collapsed: 0px;
    --topnav-height: 60px;
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Open Sans', sans-serif;
    font-size: 14px;
    color: var(--mshave-text);
    background-color: var(--mshave-bg);
    height: 100%;
}

a { color: var(--mshave-orange); text-decoration: none; }
a:hover { color: var(--mshave-dark); }

h1, h2, h3, h4, h5, h6 {
    color: var(--mshave-dark);
    font-weight: 600;
}

/* ---------- Sidebar ---------- */

.sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--mshave-dark);
    color: #ccc;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 20px;
}

.sidebar.collapsed {
    transform: translateX(calc(var(--sidebar-width) * -1));
}

.sidebar-brand {
    padding: 20px 20px 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    height: 40px;
    width: auto;
    border-radius: 50%;
}

.brand-text {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
}

.sidebar-nav {
    padding: 10px 0;
}

.sidebar-nav .nav-section {
    padding: 12px 20px 4px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.35);
    font-weight: 600;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 20px;
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    font-weight: 400;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}

.sidebar-nav .nav-link.active {
    background: rgba(240,125,26,0.2);
    color: #fff;
    border-left-color: var(--mshave-orange);
    font-weight: 600;
}

.sidebar-nav .nav-link i {
    width: 20px;
    text-align: center;
    font-size: 15px;
}

/* ---------- Main Content ---------- */

.main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    transition: margin-left 0.3s ease, width 0.3s ease;
}

.main-content.expanded {
    margin-left: 0;
    width: 100%;
}

/* ---------- Top Navbar ---------- */

.top-nav {
    height: var(--topnav-height);
    background: var(--mshave-white);
    border-bottom: 1px solid var(--mshave-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.sidebar-toggle {
    font-size: 18px;
    color: var(--mshave-text);
    padding: 6px 10px;
}

.global-search {
    flex: 0 1 auto;
}

.global-search .form-control:focus {
    border-color: var(--mshave-orange);
    box-shadow: 0 0 0 0.15rem rgba(240,125,26,0.15);
}

.top-nav-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-info {
    font-weight: 600;
    color: var(--mshave-dark);
}

/* ---------- Page Content ---------- */

.page-content {
    padding: 24px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 24px;
    margin: 0;
}

/* ---------- Cards ---------- */

.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    background: var(--mshave-white);
    margin-bottom: 20px;
}

.card-header {
    background: var(--mshave-white);
    border-bottom: 1px solid var(--mshave-border);
    font-weight: 600;
    color: var(--mshave-dark);
    padding: 16px 20px;
    border-radius: 10px 10px 0 0 !important;
}

.card-body {
    padding: 20px;
}

/* ---------- Stat Cards ---------- */

.stat-card {
    padding: 20px;
    border-radius: 10px;
    background: var(--mshave-white);
    box-shadow: 0 1px 6px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: #fff;
    flex-shrink: 0;
}

.stat-icon.orange { background: var(--mshave-orange); }
.stat-icon.red { background: #dc2626; }
.stat-icon.green { background: var(--mshave-green); }
.stat-icon.blue { background: #3b82f6; }
.stat-icon.orange { background: #f59e0b; }
.stat-icon.purple { background: #8b5cf6; }

.stat-info h3 {
    font-size: 26px;
    font-weight: 700;
    margin: 0;
    line-height: 1;
}

.stat-info p {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--mshave-text-light);
}

/* ---------- Tables ---------- */

.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    color: var(--mshave-dark);
    border-bottom-width: 2px;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
    padding: 12px;
}

.table-hover tbody tr:hover {
    background-color: rgba(240,125,26,0.04);
}

.table-clickable tbody tr {
    cursor: pointer;
}

/* ---------- Badges ---------- */

.badge {
    font-weight: 500;
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 6px;
}

/* ---------- Buttons (MSHAVE themed) ---------- */

.btn-mshave {
    background-color: var(--mshave-orange);
    border-color: var(--mshave-orange);
    color: #fff;
}
.btn-mshave:hover {
    background-color: var(--mshave-orange-hover);
    border-color: var(--mshave-orange-hover);
    color: #fff;
}

.btn-outline-mshave {
    border-color: var(--mshave-orange);
    color: var(--mshave-orange);
}
.btn-outline-mshave:hover {
    background-color: var(--mshave-orange);
    color: #fff;
}

.btn-mshave-green {
    background-color: var(--mshave-green);
    border-color: var(--mshave-green);
    color: #fff;
}
.btn-mshave-green:hover {
    background-color: var(--mshave-green-hover);
    border-color: var(--mshave-green-hover);
    color: #fff;
}

.btn-mshave-dark {
    background-color: var(--mshave-dark);
    border-color: var(--mshave-dark);
    color: #fff;
}
.btn-mshave-dark:hover {
    background-color: #1a1e24;
    border-color: #1a1e24;
    color: #fff;
}

/* ---------- Forms ---------- */

.form-control:focus, .form-select:focus {
    border-color: var(--mshave-orange);
    box-shadow: 0 0 0 0.2rem rgba(240,125,26,0.15);
}

/* Tom Select (searchable dropdowns) */
.ts-wrapper.focus .ts-control {
    border-color: var(--mshave-orange) !important;
    box-shadow: 0 0 0 0.2rem rgba(240,125,26,0.15) !important;
}
.ts-dropdown .active {
    background-color: var(--mshave-orange) !important;
    color: #fff !important;
}
.ts-wrapper .ts-control {
    border-radius: 6px;
    min-height: 38px;
}

.form-label {
    font-weight: 600;
    color: var(--mshave-dark);
    font-size: 13px;
    margin-bottom: 4px;
}

/* ---------- Login Page ---------- */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--mshave-dark) 0%, #3a3f47 100%);
}

.login-card {
    background: var(--mshave-white);
    border-radius: 14px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.login-card .brand {
    text-align: center;
    margin-bottom: 30px;
}

.login-card .brand img {
    height: 50px;
    margin-bottom: 10px;
}

.login-card .brand h2 {
    font-size: 22px;
    color: var(--mshave-dark);
    margin: 0;
}

.login-card .brand p {
    color: var(--mshave-text-light);
    font-size: 13px;
    margin: 4px 0 0;
}

/* ---------- Booking Detail / Work Card ---------- */

.detail-grid {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 0;
}

.detail-label {
    padding: 10px 14px;
    font-weight: 600;
    color: var(--mshave-dark);
    background: #fafafa;
    border-bottom: 1px solid var(--mshave-border);
    font-size: 13px;
}

.detail-value {
    padding: 10px 14px;
    border-bottom: 1px solid var(--mshave-border);
}

.note-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--mshave-border);
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.note-item:last-child { border-bottom: none; }

.note-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.note-icon.product { background: #dbeafe; color: #2563eb; }
.note-icon.order { background: #fef3c7; color: #d97706; }
.note-icon.comment { background: #e0e7ff; color: #4f46e5; }
.note-icon.info { background: #d1fae5; color: #059669; }
.note-icon.internal { background: #f3e8ff; color: #7c3aed; }
.note-icon.datemoved { background: #fee2e2; color: #dc2626; }

.note-content { flex: 1; }
.note-content strong { color: var(--mshave-dark); }
.note-content .note-time { font-size: 12px; color: #999; }

/* ---------- Slot Grid ---------- */

.slot-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
}

.slot-card {
    padding: 14px;
    border-radius: 8px;
    border: 2px solid var(--mshave-border);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.slot-card:hover {
    border-color: var(--mshave-orange);
    box-shadow: 0 2px 8px rgba(240,125,26,0.1);
}

.slot-card.selected {
    border-color: var(--mshave-orange);
    background: rgba(240,125,26,0.05);
}

.slot-card.booked {
    background: #f3f4f6;
    border-color: #d1d5db;
    cursor: not-allowed;
    opacity: 0.6;
}

.slot-card .slot-time {
    font-size: 16px;
    font-weight: 700;
    color: var(--mshave-dark);
}

.slot-card .slot-type {
    font-size: 12px;
    color: var(--mshave-text-light);
    margin-top: 2px;
}

.slot-card .slot-avail {
    font-size: 11px;
    margin-top: 6px;
    color: var(--mshave-green);
    font-weight: 600;
}

/* ---------- Calendar Date Picker ---------- */

.calendar-day {
    position: relative;
}

.calendar-day.has-slots::after {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--mshave-green);
    border-radius: 50%;
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
}

/* ---------- Barcode Display ---------- */

.barcode-display {
    text-align: center;
    padding: 16px;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid var(--mshave-border);
}

.barcode-display img {
    max-width: 200px;
    height: auto;
}

.barcode-display .ean-text {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: 700;
    color: var(--mshave-dark);
    margin-top: 6px;
    letter-spacing: 2px;
}

/* ---------- Import Table ---------- */

.import-preview {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--mshave-border);
    border-radius: 8px;
}

/* ---------- Stock Indicator ---------- */

.stock-low { color: #dc2626; font-weight: 600; }
.stock-ok { color: var(--mshave-green); font-weight: 600; }

/* ---------- Toast / Notifications ---------- */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
}

/* ---------- Loading Spinner ---------- */

.spinner-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ---------- Customer Booking Page ---------- */

.customer-wrapper {
    min-height: 100vh;
    background: var(--mshave-bg);
}

.customer-header {
    background: var(--mshave-dark);
    padding: 20px 0;
    color: #fff;
    text-align: center;
}

.customer-header h1 {
    color: #fff;
    font-size: 22px;
    margin: 0;
}

.customer-header p {
    color: rgba(255,255,255,0.7);
    margin: 4px 0 0;
    font-size: 14px;
}

.booking-steps {
    display: flex;
    justify-content: center;
    gap: 0;
    margin: 30px 0;
}

.booking-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    color: #999;
    font-weight: 600;
    font-size: 14px;
}

.booking-step.active {
    color: var(--mshave-orange);
}

.booking-step.done {
    color: var(--mshave-green);
}

.booking-step .step-num {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid currentColor;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
}

.booking-step.active .step-num {
    background: var(--mshave-orange);
    color: #fff;
    border-color: var(--mshave-orange);
}

.booking-step.done .step-num {
    background: var(--mshave-green);
    color: #fff;
    border-color: var(--mshave-green);
}

.step-arrow {
    color: #ccc;
    font-size: 18px;
    margin: 0 4px;
}

/* ---------- Responsive ---------- */

@media (max-width: 991px) {
    .sidebar {
        transform: translateX(calc(var(--sidebar-width) * -1));
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        width: 100%;
    }
    .booking-steps {
        flex-wrap: wrap;
    }
}

@media (max-width: 576px) {
    .page-content {
        padding: 16px;
    }
    .stat-card {
        padding: 14px;
    }
    .detail-grid {
        grid-template-columns: 1fr;
    }
    .detail-label {
        border-bottom: none;
        padding-bottom: 2px;
    }
}

/* ---------- Print Styles ---------- */

@media print {
    .sidebar, .top-nav, .btn, .no-print { display: none !important; }
    .main-content { margin-left: 0; width: 100%; }
    .page-content { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; }
}
