/* ============================================================================
   SHIPS WMS - STREAMLIT V3 DESIGN SYSTEM
   Compact, Professional, Minimal Warehouse Operations UI
   ============================================================================ */

/* ============================================================================
   1. VARIABLES & IMPORTS
   ============================================================================ */

:root {
    /* Primary Colors */
    --primary: #0052CC;
    --primary-dark: #0041A8;
    --primary-light: #E3F2FD;

    /* Status Colors */
    --success: #10B981;
    --warning: #F59E0B;
    --danger: #EF4444;
    --info: #3B82F6;

    /* Neutral Colors (Dark Theme) */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F8F9FA;
    --bg-tertiary: #F0F1F3;
    --text-primary: #1F2937;
    --text-secondary: #6B7280;
    --text-tertiary: #9CA3AF;
    --border: #E5E7EB;

    /* Sidebar */
    --sidebar-width: 200px;
    --sidebar-width-mini: 70px;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 12px;
    --spacing-lg: 16px;
    --spacing-xl: 24px;

    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* ============================================================================
   2. RESET & BASE STYLES
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    line-height: 1.5;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

/* ============================================================================
   3. LAYOUT STRUCTURE
   ============================================================================ */

.ships-wrapper {
    display: flex;
    flex: 1;
    min-height: 100vh;
}

.ships-sidebar {
    width: var(--sidebar-width);
    background-color: #1F2937;
    color: #FFFFFF;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    border-right: 1px solid rgba(0, 0, 0, 0.2);
    transition: width 0.3s ease;
    z-index: 1000;
}

.ships-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.ships-navbar {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    padding: var(--spacing-md) var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
    height: 60px;
}

.ships-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--spacing-lg);
}

.ships-footer {
    background-color: var(--bg-primary);
    border-top: 1px solid var(--border);
    padding: var(--spacing-md) var(--spacing-lg);
    text-align: center;
    font-size: 12px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

/* ============================================================================
   4. SIDEBAR STYLING
   ============================================================================ */

.sidebar-header {
    padding: var(--spacing-md);
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: var(--spacing-md);
}

.sidebar-logo {
    width: 100%;
    max-width: 140px;
    height: auto;
    border-radius: 6px;
    margin-bottom: var(--spacing-sm);
}

.sidebar-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.7;
    margin: var(--spacing-md) var(--spacing-md) var(--spacing-sm);
    padding-left: var(--spacing-md);
}

.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-menu-item {
    margin: 0;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: 10px var(--spacing-md);
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    cursor: pointer;
    border-left: 3px solid transparent;
    white-space: nowrap;
}

.sidebar-menu-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
    border-left-color: var(--primary);
}

.sidebar-menu-link.active {
    background-color: rgba(0, 82, 204, 0.15);
    color: #FFFFFF;
    border-left-color: var(--primary);
}

.sidebar-menu-link i {
    width: 20px;
    font-size: 16px;
}

/* ============================================================================
   5. NAVBAR STYLING
   ============================================================================ */

.navbar-brand {
    font-size: 16px;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.navbar-brand i {
    font-size: 20px;
}

.navbar-actions {
    display: flex;
    align-items: center;
    gap: var(--spacing-lg);
}

.navbar-icon-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 18px;
    padding: var(--spacing-sm);
    border-radius: 6px;
    transition: all 0.2s ease;
    position: relative;
}

.navbar-icon-btn:hover {
    background-color: var(--bg-tertiary);
    color: var(--primary);
}

.navbar-badge {
    position: absolute;
    top: 0;
    right: 0;
    background-color: var(--danger);
    color: white;
    font-size: 10px;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: 700;
}

/* ============================================================================
   6. KPI CARDS (Streamlit Style)
   ============================================================================ */

.kpi-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.kpi-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: var(--spacing-lg);
    border-left: 5px solid var(--primary);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.kpi-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.kpi-card.warning {
    border-left-color: var(--warning);
}

.kpi-card.danger {
    border-left-color: var(--danger);
}

.kpi-card.success {
    border-left-color: var(--success);
}

.kpi-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

.kpi-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.kpi-change {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: var(--spacing-sm);
}

/* ============================================================================
   7. CARD STYLING
   ============================================================================ */

.card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border);
    background-color: var(--bg-tertiary);
}

.card-header h5 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.card-body {
    padding: var(--spacing-lg);
}

.card-footer {
    padding: var(--spacing-md) var(--spacing-lg);
    border-top: 1px solid var(--border);
    background-color: var(--bg-tertiary);
    font-size: 12px;
    color: var(--text-tertiary);
}

/* ============================================================================
   8. ALERT STYLING
   ============================================================================ */

.alert {
    border-left: 4px solid;
    border-radius: 6px;
    padding: var(--spacing-md) var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    font-size: 13px;
}

.alert-danger {
    background-color: #FEE2E2;
    border-color: var(--danger);
    color: #7F1D1D;
}

.alert-warning {
    background-color: #FEF3C7;
    border-color: var(--warning);
    color: #78350F;
}

.alert-success {
    background-color: #D1FAE5;
    border-color: var(--success);
    color: #065F46;
}

.alert-info {
    background-color: #DBEAFE;
    border-color: var(--info);
    color: #0C2340;
}

/* ============================================================================
   9. BADGES & STATUS
   ============================================================================ */

.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

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

.badge-success {
    background-color: #D1FAE5;
    color: var(--success);
}

.badge-warning {
    background-color: #FEF3C7;
    color: var(--warning);
}

.badge-danger {
    background-color: #FEE2E2;
    color: var(--danger);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.status-aman {
    background-color: #D1FAE5;
    color: #065F46;
}

.status-menipis {
    background-color: #FEF3C7;
    color: #78350F;
}

.status-kosong {
    background-color: #FEE2E2;
    color: #7F1D1D;
}

/* ============================================================================
   10. BUTTONS
   ============================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

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

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

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

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 12px 24px;
    font-size: 14px;
}

.btn-group {
    display: flex;
    gap: var(--spacing-sm);
}

/* ============================================================================
   11. TABLES
   ============================================================================ */

.table-responsive {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
}

.table thead th {
    background-color: var(--bg-tertiary);
    padding: 12px var(--spacing-lg);
    text-align: left;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    border-bottom: 2px solid var(--border);
}

.table tbody td {
    padding: 12px var(--spacing-lg);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-primary);
}

.table tbody tr:hover {
    background-color: var(--bg-tertiary);
    transition: background-color 0.2s ease;
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================================================
   12. FORMS
   ============================================================================ */

.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-control {
    display: block;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control::placeholder {
    color: var(--text-tertiary);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 20px;
    padding-right: 32px;
}

/* ============================================================================
   13. GRID LAYOUTS
   ============================================================================ */

.grid {
    display: grid;
    gap: var(--spacing-lg);
}

.grid-2 {
    grid-template-columns: repeat(2, 1fr);
}

.grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.grid-4 {
    grid-template-columns: repeat(4, 1fr);
}

.grid-auto {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Dashboard specific: 2 column layout (chart left, alerts right) */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2.5fr 1.5fr;
    gap: var(--spacing-lg);
}

/* ============================================================================
   14. SPACING UTILITIES
   ============================================================================ */

.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }

.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }

.p-2 { padding: var(--spacing-sm); }
.p-3 { padding: var(--spacing-md); }
.p-4 { padding: var(--spacing-lg); }

.gap-2 { gap: var(--spacing-sm); }
.gap-3 { gap: var(--spacing-md); }
.gap-4 { gap: var(--spacing-lg); }

/* ============================================================================
   15. TYPOGRAPHY
   ============================================================================ */

h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    margin: 0 0 var(--spacing-md) 0;
    color: var(--text-primary);
}

h1 { font-size: 28px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
h4 { font-size: 16px; }
h5 { font-size: 15px; }
h6 { font-size: 13px; }

p {
    margin: 0 0 var(--spacing-md) 0;
    line-height: 1.6;
}

small {
    font-size: 12px;
    color: var(--text-secondary);
}

.text-muted {
    color: var(--text-tertiary);
}

.text-primary {
    color: var(--primary);
}

.text-success {
    color: var(--success);
}

.text-warning {
    color: var(--warning);
}

.text-danger {
    color: var(--danger);
}

/* ============================================================================
   16. RESPONSIVE DESIGN
   ============================================================================ */

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

    .kpi-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .ships-sidebar {
        width: var(--sidebar-width-mini);
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 1001;
    }

    .ships-main {
        margin-left: var(--sidebar-width-mini);
    }

    .sidebar-title,
    .sidebar-menu-link span {
        display: none;
    }

    .sidebar-menu-link {
        justify-content: center;
        padding: var(--spacing-lg);
    }

    .sidebar-menu-link i {
        width: auto;
    }

    .kpi-container {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--spacing-md);
    }

    .kpi-card {
        padding: var(--spacing-md);
    }

    .kpi-value {
        font-size: 24px;
    }

    .ships-navbar {
        padding: var(--spacing-md);
        height: auto;
    }

    .navbar-brand {
        font-size: 14px;
    }

    .navbar-actions {
        gap: var(--spacing-md);
    }
}

@media (max-width: 576px) {
    .kpi-container {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .kpi-card {
        padding: var(--spacing-md);
    }

    .kpi-value {
        font-size: 20px;
    }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .btn {
        width: 100%;
    }
}

/* ============================================================================
   17. ANIMATIONS
   ============================================================================ */

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

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ============================================================================
   18. PRINT STYLES
   ============================================================================ */

@media print {
    .ships-sidebar,
    .ships-navbar,
    .ships-footer,
    .btn {
        display: none;
    }

    .ships-main {
        margin-left: 0;
    }

    .ships-content {
        padding: 0;
    }
}
