/* PesaShip - Sophisticated App Styles */
:root {
    --pesaship-primary: #0056B4;
    --pesaship-secondary: #3CB85C;
    --pesaship-primary-light: rgba(0, 86, 180, 0.08);
    --pesaship-secondary-light: rgba(60, 184, 92, 0.12);
}

body { min-height: 100vh; background: #f8fafc; }
.btn-primary { background-color: var(--pesaship-primary); border-color: var(--pesaship-primary); }
.btn-primary:hover { background-color: #004494; border-color: #004494; }
.btn-success { background-color: var(--pesaship-secondary); border-color: var(--pesaship-secondary); }
.btn-success:hover { background-color: #2ea34d; border-color: #2ea34d; }
.text-primary { color: var(--pesaship-primary) !important; }
.bg-primary { background-color: var(--pesaship-primary) !important; }

/* Stat Cards */
.stat-card {
    border: none;
    border-radius: 12px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,0.08) !important; }
.stat-card .stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; }
.stat-card .stat-label { font-size: 0.8rem; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; }

/* Sidebar */
.sidebar-wrapper {
    width: 260px;
    min-height: calc(100vh - 56px);
    background: #1e293b;
    border-right: 1px solid #334155;
    transition: width 0.2s ease;
    position: relative;
}
.sidebar-wrapper.collapsed {
    width: 64px;
}
.sidebar-wrapper.collapsed .sidebar-section { display: none; }
.sidebar-wrapper.collapsed .sidebar-nav .nav-link { justify-content: center; padding-left: 0; }
.sidebar-wrapper.collapsed .sidebar-nav .nav-link .bi { margin: 0 !important; }
.sidebar-wrapper.collapsed .sidebar-nav .nav-link { font-size: 0; }
.sidebar-wrapper.collapsed .sidebar-nav .nav-link .bi { font-size: 1.25rem; }
.sidebar-toggle {
    position: absolute;
    right: -14px;
    top: 12px;
    z-index: 10;
    background: var(--pesaship-primary) !important;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}
.sidebar-wrapper.collapsed .sidebar-toggle .bi-chevron-left { transform: rotate(180deg); }
.sidebar-nav .nav-link {
    color: #94a3b8;
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    margin: 0 0.5rem;
}
.sidebar-nav .nav-link:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}
.sidebar-nav .nav-link.active {
    background: var(--pesaship-primary);
    color: #fff;
    font-weight: 600;
}
.sidebar-section { font-size: 0.7rem; color: #64748b; padding: 0.75rem 1.25rem; text-transform: uppercase; letter-spacing: 1px; }

/* Navbar active link */
.navbar-dark .nav-link.active { background: rgba(255,255,255,0.15); border-radius: 6px; }

/* Main content area */
.main-content { flex: 1; padding: 1.5rem; background: #f8fafc; }

/* Running orders animated dot */
.running-dot { animation: pulse 1.5s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

/* Table enhancements */
.table-modern { border-collapse: separate; border-spacing: 0; }
.table-modern thead th { background: #f8fafc; font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.5px; color: #64748b; padding: 0.875rem 1rem; border-bottom: 2px solid #e2e8f0; }
.table-modern tbody td { padding: 0.875rem 1rem; vertical-align: middle; }
.table-modern tbody tr { transition: background 0.15s; }
.table-modern tbody tr:hover { background: #f8fafc; }

/* Table → collapsible cards on small screens */
@media (max-width: 767.98px) {
    .table-responsive-cards thead { display: none; }
    .table-responsive-cards tbody tr {
        display: block;
        margin-bottom: 1rem;
        padding: 1rem;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }
    .table-responsive-cards tbody tr:hover { background: #fff; }
    .table-responsive-cards tbody td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.5rem 0;
        border: none;
    }
    .table-responsive-cards tbody td:not(:last-child) { border-bottom: 1px solid #f1f5f9; }
    .table-responsive-cards tbody td[data-label]::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.75rem;
        color: #64748b;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        margin-right: 0.75rem;
        flex-shrink: 0;
    }
    .table-responsive-cards tbody td[data-label] { flex-wrap: wrap; }
    .table-responsive-cards tbody td .btn, .table-responsive-cards tbody td .badge { margin-top: 0.25rem; }
    .table-responsive-cards tbody td:has(.btn) { flex-direction: column; align-items: stretch; }
    .table-responsive-cards tbody td:has(.btn)::before { margin-bottom: 0.25rem; }
}

/* Collapsible accordion cards (replaces table on mobile) */
.table-cards-accordion { margin-bottom: 0; }
.table-card-accordion-item {
    margin-bottom: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    overflow: hidden;
}
.table-card-accordion-item[open] {
    border-color: var(--pesaship-primary);
    box-shadow: 0 0 0 2px rgba(0, 86, 180, 0.15);
}
.table-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 1rem 1.25rem;
    border: none;
    background: #fff;
    font-size: 1rem;
    text-align: left;
    cursor: pointer;
    list-style: none;
}
.table-card-header::-webkit-details-marker,
.table-card-header::marker { display: none; }
.table-card-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; flex: 1; }
.table-card-summary-cell { display: inline-flex; align-items: center; }
.table-card-header .bi { font-size: 1.1rem; color: var(--pesaship-primary); flex-shrink: 0; margin-left: 0.5rem; }
.table-card-icon-minus { display: none; }
.table-card-accordion-item[open] .table-card-icon-plus { display: none; }
.table-card-accordion-item[open] .table-card-icon-minus { display: inline-block; }
.table-card-body {
    padding: 0 1.25rem 1rem;
    border-top: 1px solid #f1f5f9;
}
.table-card-body .table-card-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
}
.table-card-body .table-card-row:last-child { border-bottom: none; }
.table-card-body .table-card-row[data-label]::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: 0.75rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-right: 0.75rem;
}
.table-card-body .table-card-row:has(.btn) { flex-direction: column; align-items: stretch; }
.table-card-body .table-card-row:has(.btn)::before { margin-bottom: 0.25rem; }

/* Key-value tables (order detail, profile) – stack on small screens */
@media (max-width: 767.98px) {
    .table-responsive-stack tr {
        display: block;
        margin-bottom: 1rem;
        padding: 1rem;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        background: #fff;
    }
    .table-responsive-stack th {
        display: block;
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #64748b;
        padding: 0 0 0.25rem 0;
    }
    .table-responsive-stack td {
        display: block;
        padding: 0 0 0.75rem 0;
    }
    .table-responsive-stack td:last-child { padding-bottom: 0; }
    .table-responsive-stack tr:not(:has(th)) td:first-child {
        font-size: 0.75rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        color: #64748b;
    }
}

/* Badges */
.badge-status { font-size: 0.7rem; padding: 0.35em 0.65em; font-weight: 500; }
.badge-status.new { background: #dbeafe; color: #1d4ed8; }
.badge-status.running { background: #e0e7ff; color: #4f46e5; }
.badge-status.completed { background: #d1fae5; color: #059669; }
.badge-status.disputed { background: #fef3c7; color: #d97706; }
.badge-status.canceled { background: #f1f5f9; color: #64748b; }
.badge-status.pending { background: #fef3c7; color: #d97706; }

/* Activity feed */
.activity-item { padding: 0.75rem 0; border-bottom: 1px solid #f1f5f9; }
.activity-item:last-child { border-bottom: none; }
.activity-item .activity-icon { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; }
.activity-item .activity-time { font-size: 0.75rem; color: #94a3b8; }

/* Empty state */
.empty-state { padding: 3rem 2rem; text-align: center; }
.empty-state .empty-icon { font-size: 3rem; color: #cbd5e1; margin-bottom: 1rem; }
.empty-state .empty-title { font-weight: 600; color: #475569; margin-bottom: 0.5rem; }
.empty-state .empty-text { color: #94a3b8; font-size: 0.9rem; margin-bottom: 1.5rem; }

/* Chart container */
.chart-container { position: relative; height: 280px; }

/* Page header */
.page-header { margin-bottom: 1.5rem; }
.page-header .page-title { font-size: 1.5rem; font-weight: 700; color: #0f172a; margin: 0; }
.page-header .page-subtitle { font-size: 0.9rem; color: #64748b; margin-top: 0.25rem; }

/* Cards */
.card-modern { border: none; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.card-modern .card-header { background: #fff; border-bottom: 1px solid #f1f5f9; padding: 1rem 1.25rem; font-weight: 600; border-radius: 12px 12px 0 0; }
.card-modern .card-body { padding: 1.25rem; }

/* ========== PesaShip Form Design System ========== */
.form-auth-card,
.pesaship-form .card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 86, 180, 0.08);
    overflow: hidden;
}
.form-auth-card .card-body,
.pesaship-form .card-body {
    padding: 2rem;
}
.form-auth-card .card-title,
.pesaship-form .card-title {
    font-weight: 600;
    color: #0f172a;
    letter-spacing: -0.02em;
}
.form-auth-card .card-title:not(.text-center)::after,
.pesaship-form .card-title:not(.text-center)::after {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: linear-gradient(90deg, var(--pesaship-primary), var(--pesaship-secondary));
    border-radius: 2px;
    margin-top: 0.5rem;
}
.form-auth-card .card-title.text-center::after,
.pesaship-form .card-title.text-center::after {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: linear-gradient(90deg, var(--pesaship-primary), var(--pesaship-secondary));
    border-radius: 2px;
    margin: 0.5rem auto 0;
}

/* Form groups with left accent */
.pesaship-form .form-floating,
.pesaship-form .mb-3 {
    position: relative;
}
.pesaship-form .form-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #475569;
    margin-bottom: 0.5rem;
}
.pesaship-form .form-control,
.pesaship-form .form-select {
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}
.pesaship-form .form-control:hover,
.pesaship-form .form-select:hover {
    border-color: #cbd5e1;
}
.pesaship-form .form-control:focus,
.pesaship-form .form-select:focus {
    border-color: var(--pesaship-primary);
    box-shadow: 0 0 0 3px rgba(0, 86, 180, 0.15);
    outline: none;
}
.pesaship-form .form-control::placeholder {
    color: #94a3b8;
}
.pesaship-form textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* Input group (password toggle) */
.pesaship-form .input-group .form-control {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}
.pesaship-form .input-group .btn {
    border: 1.5px solid #e2e8f0;
    border-left: none;
    border-radius: 0 10px 10px 0;
    background: #f8fafc;
    color: #64748b;
}
.pesaship-form .input-group .btn:hover {
    background: #f1f5f9;
    color: var(--pesaship-primary);
    border-color: #e2e8f0;
}

/* Submit button */
.pesaship-form .btn-primary,
.form-auth-card .btn-primary {
    padding: 0.875rem 1.5rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, var(--pesaship-primary) 0%, #004494 100%);
    box-shadow: 0 4px 14px rgba(0, 86, 180, 0.35);
    transition: transform 0.2s, box-shadow 0.2s;
}
.pesaship-form .btn-primary:hover,
.form-auth-card .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 86, 180, 0.4);
}

/* Form links */
.pesaship-form .card-body > p a,
.form-auth-card .card-body > p a {
    color: var(--pesaship-primary);
    font-weight: 500;
    text-decoration: none;
}
.pesaship-form .card-body > p a:hover,
.form-auth-card .card-body > p a:hover {
    text-decoration: underline;
}

/* Alerts in forms */
.pesaship-form .alert-danger,
.form-auth-card .alert-danger {
    border-radius: 10px;
    border: none;
    background: rgba(220, 38, 38, 0.1);
    color: #b91c1c;
}

/* Modals - form styling */
.modal-content {
    border: none;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}
.modal-header {
    border-bottom: 1px solid #f1f5f9;
    padding: 1.25rem 1.5rem;
}
.modal-body .form-control,
.modal-body .form-select {
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
}
.modal-body .form-control:focus,
.modal-body .form-select:focus {
    border-color: var(--pesaship-primary);
    box-shadow: 0 0 0 3px rgba(0, 86, 180, 0.15);
}
.modal-body .form-label {
    font-weight: 600;
    color: #475569;
    font-size: 0.875rem;
}

/* Forms in card-modern (admin, dashboard) */
.card-modern .form-control,
.card-modern .form-select {
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.card-modern .form-control:focus,
.card-modern .form-select:focus {
    border-color: var(--pesaship-primary);
    box-shadow: 0 0 0 3px rgba(0, 86, 180, 0.15);
}
.card-modern .form-label {
    font-weight: 600;
    color: #475569;
    font-size: 0.875rem;
}

/* Form switches (admin) */
.form-check-input:checked {
    background-color: var(--pesaship-primary);
    border-color: var(--pesaship-primary);
}
.form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(0, 86, 180, 0.2);
}

/* Outline buttons in auth flow */
.form-auth-card .btn-outline-primary,
.pesaship-form .btn-outline-primary {
    border: 2px solid var(--pesaship-primary);
    color: var(--pesaship-primary);
    font-weight: 600;
    border-radius: 10px;
}
.form-auth-card .btn-outline-primary:hover,
.pesaship-form .btn-outline-primary:hover {
    background: rgba(0, 86, 180, 0.08);
    border-color: var(--pesaship-primary);
    color: var(--pesaship-primary);
}

/* Auth pages - centering & background */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #f0f7ff 0%, #f8fafc 50%, #f1f5f9 100%);
}
.auth-page .auth-logo {
    margin-bottom: 2rem;
}
.auth-page .auth-logo img {
    filter: drop-shadow(0 2px 8px rgba(0, 86, 180, 0.15));
}

/* Bottom Navigation (Mobile) - Similar to attachment design */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    padding: 0.5rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom, 0px));
    background: #fff;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    border-top: 3px solid var(--pesaship-primary);
}
.bottom-nav-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 0.25rem;
}
.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.25rem;
    text-decoration: none;
    color: #64748b;
    font-size: 0.7rem;
    font-weight: 500;
    border-radius: 12px;
    transition: color 0.2s, background 0.2s;
}
.bottom-nav-item:hover {
    color: var(--pesaship-primary);
}
.bottom-nav-item.active {
    color: var(--pesaship-primary);
}
.bottom-nav-icon-wrap {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.2rem;
    border-radius: 50%;
    transition: background 0.2s;
}
.bottom-nav-item .bi {
    font-size: 1.35rem;
}
.bottom-nav-item.active .bottom-nav-icon-wrap {
    background: rgba(0, 86, 180, 0.12);
}
.bottom-nav-item.active .bi {
    color: var(--pesaship-primary);
}
.bottom-nav-label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.bottom-nav-spacer {
    height: 76px;
    height: calc(76px + env(safe-area-inset-bottom, 0px));
}
