@import url('https://fonts.googleapis.com/css2?family=Archivo:wdth,wght@62..125,400..700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
    --bg-dark: #fcfaf7;
    --bg-surface: #f3edd8;
    --bg-surface-light: #e5deb8;
    --color-primary: #8f6e40; /* Golden brown accent with contrast */
    --color-secondary: #60533e; /* Khaki text */
    --color-text-main: #24201a;
    --color-text-muted: #5e523f;
    --border-color: #cabfa3;
    
    /* Status Colors */
    --status-tersedia: #166534;
    --status-disewa: #9a3412;
    --status-maint: #1e40af;
    --status-rosak: #991b1b;
    --status-hilang: #7c2d12;
    
    --font-sans: 'Archivo', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--color-text-main);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-dark);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--color-primary);
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar (Desktop) */
aside {
    width: 260px;
    background-color: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand-section {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

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

.brand-logo-icon {
    width: 32px;
    height: 32px;
    border: 2px solid var(--color-primary);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    color: var(--color-primary);
    font-weight: bold;
}

.brand-logo-img {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: #000000;
}

.brand-subtitle {
    font-size: 0.75rem;
    color: var(--color-primary);
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

nav {
    flex: 1;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.nav-item:hover, .nav-item.active {
    color: var(--color-text-main);
    background-color: var(--bg-surface-light);
    border-color: var(--border-color);
}

.nav-item.active {
    border-left: 3px solid var(--color-primary);
    color: var(--color-primary);
}

.nav-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* User Info Section in Sidebar */
.user-info-section {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    font-size: 0.8rem;
    color: var(--color-text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-badge {
    background-color: var(--bg-surface-light);
    color: var(--color-primary);
    padding: 2px 8px;
    border-radius: 3px;
    font-family: var(--font-mono);
    border: 1px solid var(--border-color);
}

/* Main Content Area */
main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

header {
    background-color: var(--bg-surface);
    height: 70px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.view-title {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.header-actions {
    display: flex;
    gap: 12px;
}

/* Content Body */
.content-body {
    padding: 32px;
    flex: 1;
    overflow-y: auto;
}

.view-pane {
    display: none;
    animation: fadeIn 0.15s ease-out;
}

.view-pane.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Typography & Utility Elements */
h2 {
    font-size: 1.1rem;
    color: var(--color-secondary);
    font-weight: 600;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 3px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid var(--border-color);
    font-family: var(--font-sans);
}

.btn-primary {
    background-color: var(--color-primary);
    color: #ffffff;
    border-color: var(--color-primary);
}

.btn-primary:hover {
    background-color: #725732;
    border-color: #725732;
}

.btn-secondary {
    background-color: var(--bg-surface-light);
    color: var(--color-text-main);
}

.btn-secondary:hover {
    background-color: #d7cd9f;
    border-color: var(--color-secondary);
}

.btn-danger {
    background-color: #dc2626;
    color: #fff;
    border-color: #dc2626;
}

.btn-danger:hover {
    background-color: #ef4444;
    border-color: #ef4444;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 0.75rem;
}

/* Dashboard Summary Cards */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.summary-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    padding: 16px;
    border-radius: 3px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.summary-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
}

.summary-value {
    font-size: 1.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--color-primary);
}

.summary-card.status-tersedia .summary-value { color: var(--status-tersedia); }
.summary-card.status-disewa .summary-value { color: var(--status-disewa); }
.summary-card.status-maint .summary-value { color: var(--status-maint); }
.summary-card.status-rosak .summary-value { color: var(--status-rosak); }

/* Dashboard layout sections */
.dashboard-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

@media (max-width: 1024px) {
    .dashboard-sections {
        grid-template-columns: 1fr;
    }
}

.dashboard-panel {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    padding: 20px;
    min-width: 0;
}

/* Gear Tag Component */
.gear-tag {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--border-color);
    background-color: #ffffff;
    font-family: var(--font-sans);
    font-stretch: condensed;
    font-size: 0.75rem;
    padding: 2px 6px;
    border-radius: 3px;
    color: var(--color-text-main);
    letter-spacing: 0.02em;
    position: relative;
    font-weight: 500;
}

.gear-tag::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 6px;
}

.gear-tag.tersedia::before { background-color: var(--status-tersedia); }
.gear-tag.disewa::before { background-color: var(--status-disewa); }
.gear-tag.maint::before { background-color: var(--status-maint); }
.gear-tag.rosak::before { background-color: var(--status-rosak); }
.gear-tag.hilang::before { background-color: var(--status-hilang); }
.gear-tag.reserved::before { background-color: #c9a876; }

/* Dense Tables */
.table-container {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    background-color: var(--bg-surface);
    border-radius: 3px;
    margin-bottom: 16px;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

th, td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    height: 48px; /* Force uniform row height for alignment */
    vertical-align: middle;
}

th {
    background-color: var(--bg-surface-light);
    font-weight: 600;
    color: var(--color-secondary);
    text-transform: uppercase;
    font-size: 0.75rem;
    font-stretch: condensed;
    letter-spacing: 0.05em;
}

tr:hover td {
    background-color: rgba(199, 177, 142, 0.03);
}

.mono-cell {
    font-family: var(--font-mono);
}

/* Filters */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}

.search-input {
    flex: 1;
    min-width: 200px;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--color-text-main);
    padding: 8px 12px;
    border-radius: 3px;
    font-size: 0.85rem;
    font-family: var(--font-sans);
}

.search-input:focus, .select-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

.select-input {
    width: 100%;
    box-sizing: border-box;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--color-text-main);
    padding: 8px 12px;
    border-radius: 3px;
    font-size: 0.85rem;
    font-family: var(--font-sans);
    cursor: pointer;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    padding: 8px 0;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    width: 100%;
    max-width: 600px;
    border-radius: 3px;
    overflow: hidden;
    animation: modalSlideUp 0.2s ease-out;
    display: flex;
    flex-direction: column;
    max-height: 90vh;
}

.modal-content form {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex: 1;
}

.modal-content.wide {
    max-width: 800px;
}

@keyframes modalSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    background-color: var(--bg-surface-light);
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.modal-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.modal-close:hover {
    color: var(--color-text-main);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    background-color: var(--bg-surface-light);
}

/* Forms */
.form-group {
    margin-bottom: 16px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    margin-bottom: 6px;
    font-weight: 500;
}

.form-input {
    width: 100%;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    color: var(--color-text-main);
    padding: 8px 12px;
    border-radius: 3px;
    font-size: 0.85rem;
    font-family: var(--font-sans);
}

.form-input:focus {
    outline: none;
    border-color: var(--color-primary);
}

textarea.form-input {
    resize: vertical;
    min-height: 80px;
}

/* Package List & Cards */
.packages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.package-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.package-components {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.package-header {
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.package-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-primary);
}

.package-capacity {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.package-pricing {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.pricing-item {
    background-color: var(--bg-surface-light);
    border: 1px solid var(--border-color);
    padding: 8px;
    border-radius: 2px;
    text-align: center;
}

.pricing-label {
    font-size: 0.65rem;
    color: var(--color-text-muted);
    font-family: var(--font-mono);
}

.pricing-val {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--color-text-main);
}

.package-components {
    margin-bottom: 20px;
}

.component-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.8rem;
}

.component-item {
    display: flex;
    justify-content: space-between;
    padding-bottom: 4px;
    border-bottom: 1px dashed rgba(56, 48, 37, 0.5);
}

.component-qty {
    font-family: var(--font-mono);
    color: var(--color-secondary);
}

/* Staff Detail View Layout */
.staff-detail-grid {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 24px;
}

@media (max-width: 768px) {
    .staff-detail-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

.staff-sidebar-profile {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    padding: 20px;
}



/* Mobile Bottom Navigation & Mobile Header */
.mobile-header {
    display: none;
    background-color: var(--bg-surface);
    height: 60px;
    border-bottom: 1px solid var(--border-color);
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: transparent;
    filter: drop-shadow(0 -4px 10px rgba(0,0,0,0.05));
    z-index: 900;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
}

.mobile-nav::before {
    content: '';
    position: absolute;
    top: 0; bottom: 0; left: 0;
    width: calc(var(--hole-pos, 12.5%) - 69px);
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    transition: width 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: -1;
}

.mobile-nav::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0; right: 0;
    left: calc(var(--hole-pos, 12.5%) + 69px);
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    transition: left 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: -1;
}

.nav-indicator-wrapper {
    position: absolute;
    top: 0; bottom: 0;
    left: calc(var(--hole-pos, 12.5%) - 70px);
    width: 140px;
    background-color: var(--bg-surface);
    transition: left 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: -1;
    pointer-events: none;
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 140 200'%3E%3Cpath d='M 0 0 L 30.8 0 A 16 16 0 0 1 46.5 12.8 A 24 24 0 0 0 93.5 12.8 A 16 16 0 0 1 109.2 0 L 140 0 L 140 200 L 0 200 Z' fill='black'/%3E%3C/svg%3E");
    -webkit-mask-size: 140px 200px;
    -webkit-mask-repeat: no-repeat;
}

.nav-indicator-wrapper::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 140 200'%3E%3Cpath d='M 0 0 L 30.8 0 A 16 16 0 0 1 46.5 12.8 A 24 24 0 0 0 93.5 12.8 A 16 16 0 0 1 109.2 0 L 140 0' fill='none' stroke='%23cabfa3' stroke-width='2'/%3E%3C/svg%3E");
    background-size: 140px 200px;
    background-repeat: no-repeat;
    z-index: 1;
}

.nav-indicator {
    display: none;
}

.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    flex: 1;
    height: 60px;
    z-index: 1;
    position: relative;
}

.mobile-nav-item span:not(.mobile-nav-icon) {
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 1;
    transform: translateY(0);
}

.mobile-nav-item.active span:not(.mobile-nav-icon) {
    opacity: 1;
    transform: translateY(-8px);
    pointer-events: auto;
    font-weight: 600;
}

.mobile-nav-item.active {
    color: var(--color-primary);
}

.mobile-nav-icon {
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mobile-nav-item.active .mobile-nav-icon {
    transform: translateY(-14px);
    background-color: var(--color-primary);
    color: #ffffff;
    width: 44px;
    height: 44px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.mobile-nav-icon svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Mobile responsive styles */
@media (max-width: 768px) {
    aside {
        display: none;
    }
    
    header {
        display: none;
    }
    
    .mobile-header {
        display: flex;
    }
    
    .mobile-nav {
        display: flex;
    }
    
    .app-container {
        flex-direction: column;
    }
    
    main {
        padding-bottom: calc(60px + env(safe-area-inset-bottom)); /* space for bottom nav */
    }
    
    .content-body {
        padding: 16px;
    }

    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .dashboard-panel {
        padding: 12px;
    }

    th, td {
        padding: 8px 10px;
    }

    .form-row {
        flex-direction: column;
        gap: 8px;
    }
    
    /* Responsive Table to Cards */
    .responsive-card-grid {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    .responsive-card {
        background-color: var(--bg-surface);
        border: 1px solid var(--border-color);
        padding: 16px;
        border-radius: 3px;
    }
    
    .responsive-card-row {
        display: flex;
        justify-content: space-between;
        margin-bottom: 8px;
        font-size: 0.85rem;
    }
    
    .responsive-card-row:last-child {
        margin-bottom: 0;
    }
    
    .table-container.desktop-only {
        display: none;
    }
}

@media (min-width: 769px) {
    .responsive-card-grid {
        display: none;
    }
}

/* GLOBAL LOADER */
.global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: #f3edd8; /* Solid warm cream/khaki */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    transition: opacity 0.6s ease, visibility 0.6s ease;
    overflow: hidden;
}

.global-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.scattered-icons {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* Hide mobile icons by default on desktop */
.mobile-icons {
    display: none;
}

@media (max-width: 768px) {
    .desktop-icons {
        display: none;
    }
    .mobile-icons {
        display: block;
    }
}

.scatter-icon {
    position: absolute;
    background-color: #d0c6a5; /* Slightly darker tan for better visibility */
    -webkit-mask-image: var(--mask-url);
    mask-image: var(--mask-url);
    -webkit-mask-size: contain;
    mask-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    animation: gentleBob 3s ease-in-out infinite alternate;
    /* Use a negative delay so the animation starts immediately but out of sync */
    animation-delay: calc(var(--delay) * -1);
}

.loader-center-text {
    font-family: var(--font-sans);
    font-size: 4rem;
    font-weight: 800;
    line-height: 1.1;
    color: #000000;
    text-align: center;
    z-index: 2;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    animation: pulseText 2s ease-in-out infinite alternate;
}

@keyframes gentleBob {
    0% { transform: translateY(0) rotate(var(--rot, 0deg)); }
    100% { transform: translateY(-12px) rotate(var(--rot, 0deg)); }
}

@keyframes pulseText {
    0% { opacity: 0.85; transform: scale(0.98); }
    100% { opacity: 1; transform: scale(1.02); }
}

/* Flat mode for mobile nav when menu is open */
.mobile-nav.flat-mode {
    --hole-pos: -100% !important;
}
.mobile-nav.flat-mode .nav-indicator-wrapper {
    opacity: 0 !important;
}
.mobile-nav.flat-mode .mobile-nav-item.active {
    color: var(--color-text-muted);
}
.mobile-nav.flat-mode .mobile-nav-item.active .mobile-nav-icon {
    transform: none;
    background-color: transparent;
    color: currentColor;
    width: 20px;
    height: 20px;
    box-shadow: none;
}
.mobile-nav.flat-mode .mobile-nav-item.active span:not(.mobile-nav-icon) {
    transform: translateY(0);
    font-weight: 500;
}
