/* ========================================
   BASE STYLES
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #ffffff;
    color: #0d1a26;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background 0.5s ease, color 0.5s ease;
}

body.ocean-dark-mode {
    background: #0f172a;
    color: #e2e8f0;
}

/* ========================================
   MAIN LAYOUT AND CONTENT AREA
   ======================================== */
.main-layout {
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

.content-area {
    padding: 85px 24px 24px 24px;
    min-height: 100vh;
    width: 100%;
}

.page-section {
    position: relative;
    width: 100%;
}

/* Desktop - Collapsed Sidebar */
@media (min-width: 769px) {
    .maritime-sidebar.collapsed ~ .main-layout {
        margin-left: 80px;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    
}

/* Mobile - No left margin */
@media (max-width: 768px) {
    .main-layout {
        margin-left: 0 !important;
    }
    
    .content-area {
        padding: 70px 16px 20px 16px;
    }
}

/* Extra Small Screens */
@media (max-width: 480px) {
    .content-area {
        padding: 65px 12px 20px 12px;
    }
}



/* Glass Card Base */
.glass-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 30px;
    border: 1px solid rgba(21, 101, 192, 0.3);
    box-shadow: 0 20px 60px rgba(21, 101, 192, 0.15);
    transition: all 0.3s ease;
    width: 100%;
}

body.ocean-dark-mode .glass-card {
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(21, 101, 192, 0.4);
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 25px 70px rgba(21, 101, 192, 0.2);
}

.card-header {
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title {
    font-size: 20px;
    font-weight: 700;
    color: #0d1a26;
}

body.ocean-dark-mode .card-title {
    color: #e2e8f0;
}

.card-subtitle {
    font-size: 14px;
    color: #546e7a;
}

body.ocean-dark-mode .card-subtitle {
    color: #94a3b8;
}

/* Dashboard Header */
.dashboard-header {
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.dashboard-header i {
    font-size: 24px;
    color: #1976d2;
}

body.ocean-dark-mode .dashboard-header i {
    color: #42a5f5;
}

.dashboard-title {
    font-size: 42px;
    font-weight: 700;
    background: linear-gradient(135deg, #abc6e0 0%, #1565c0 40%, #5a9bdd 70%, #d56161 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -2px;
    margin-bottom: 8px;
}


.dashboard-subtitle {
    font-size: 16px;
    color: #546e7a;
    font-weight: 400;
}

body.ocean-dark-mode .dashboard-subtitle {
    color: #94a3b8;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
    width: 100%;
}

/* Table Card */
.table-card {
    grid-column: 1 / -1;
}

/* Common Table Design */
.common-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.common-table thead {
    background: rgba(21, 101, 192, 0.1);
    backdrop-filter: blur(10px);
}

body.ocean-dark-mode .common-table thead {
    background: rgba(21, 101, 192, 0.2);
}

.common-table th {
    padding: 16px 20px;
    text-align: left;
    font-size: 13px;
    font-weight: 700;
    color: #0d1a26;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid rgba(21, 101, 192, 0.2);
    cursor: pointer;
    position: relative;
}

body.ocean-dark-mode .common-table th {
    color: #e2e8f0;
    border-bottom: 2px solid rgba(21, 101, 192, 0.4);
}

.common-table th.sort-asc::after {
    content: ' ↑';
    color: #1565c0;
    font-size: 12px;
}

.common-table th.sort-desc::after {
    content: ' ↓';
    color: #1565c0;
    font-size: 12px;
}

.common-table th:first-child {
    border-top-left-radius: 12px;
}

.common-table th:last-child {
    border-top-right-radius: 12px;
}

.common-table tbody tr {
    background: rgba(255, 255, 255, 0.9);
    transition: all 0.2s ease;
}

body.ocean-dark-mode .common-table tbody tr {
    background: rgba(30, 41, 59, 0.9);
}

.common-table tbody tr:hover {
    background: rgba(187, 222, 251, 0.9);
    transform: scale(1.01);
}

body.ocean-dark-mode .common-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.1);
}

.common-table td {
    padding: 18px 20px;
    font-size: 14px;
    color: #0d1a26;
    border-bottom: 1px solid rgba(21, 101, 192, 0.2);
}

body.ocean-dark-mode .common-table td {
    color: #e2e8f0;
    border-bottom: 1px solid rgba(21, 101, 192, 0.4);
}

.common-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 12px;
}

.common-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 12px;
}

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

.job-id {
    font-weight: 600;
    color: #1565c0;
}

body.ocean-dark-mode .job-id {
    color: #64b5f6;
}

.status-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-badge.status-success {
    background: linear-gradient(135deg, #43a047 0%, #2e7d32 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(67, 160, 71, 0.3);
}

.status-badge.status-failed {
    background: #ff0000;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(211, 47, 47, 0.3);
}

.status-badge.status-pending {
    background: linear-gradient(135deg, #ffb300 0%, #f57c00 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(255, 179, 0, 0.3);
}

.status-badge.status-grey {
    background: #9e9e9e;
    color: white;
    box-shadow: 0 2px 8px rgba(158, 158, 158, 0.3);
}

.credit-value {
    font-weight: 600;
    color: #1976d2;
}

body.ocean-dark-mode .credit-value {
    color: #42a5f5;
}

/* Controls Container */
.controls-container {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    width: 100%;
    gap: 10px;
}

.search-input {
    flex: 1;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(21, 101, 192, 0.2);
    background: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    color: #0d1a26;
    outline: none;
    transition: all 0.3s ease;
    padding-left: 35px;
}

body.ocean-dark-mode .search-input {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(21, 101, 192, 0.4);
    color: #e2e8f0;
}

.search-input:focus {
    border-color: #1565c0;
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.1);
}

body.ocean-dark-mode .search-input:focus {
    border-color: #64b5f6;
    box-shadow: 0 0 0 3px rgba(100, 181, 246, 0.2);
}

.search-input::placeholder {
    color: #546e7a;
}

body.ocean-dark-mode .search-input::placeholder {
    color: #94a3b8;
}

.search-container {
    position: relative;
    flex: 1;
}

.search-container i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #546e7a;
}

body.ocean-dark-mode .search-container i {
    color: #94a3b8;
}

.filter-select {
    width: 150px;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(21, 101, 192, 0.2);
    background: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    color: #0d1a26;
    outline: none;
    transition: all 0.3s ease;
    appearance: none;
    padding-left: 35px;
}

body.ocean-dark-mode .filter-select {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(21, 101, 192, 0.4);
    color: #e2e8f0;
}

.filter-select:focus {
    border-color: #1565c0;
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.1);
}

body.ocean-dark-mode .filter-select:focus {
    border-color: #64b5f6;
    box-shadow: 0 0 0 3px rgba(100, 181, 246, 0.2);
}

.filter-container {
    position: relative;
}

.filter-container i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #546e7a;
}

body.ocean-dark-mode .filter-container i {
    color: #94a3b8;
}

/* Status Buttons */
.status-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    width: 100%;
}

.status-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgba(21, 101, 192, 0.2);
    background: rgba(255, 255, 255, 0.9);
    color: #0d1a26;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
}

body.ocean-dark-mode .status-btn {
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(21, 101, 192, 0.4);
    color: #e2e8f0;
}

.status-btn:hover {
    background: #bbdefb;
}

body.ocean-dark-mode .status-btn:hover {
    background: rgba(59, 130, 246, 0.1);
}

.status-btn.active {
    background: #1565c0;
    color: white;
    border-color: #1565c0;
}

body.ocean-dark-mode .status-btn.active {
    background: #64b5f6;
    border-color: #64b5f6;
}

/* Enhanced Pagination Styling */
.pagination-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 25px;
    margin-bottom: 25px;
    gap: 15px;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-btn {
    padding: 10px 14px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1e3a8a;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 10px rgba(21, 101, 192, 0.2);
}

body.ocean-dark-mode .page-btn {
    background: linear-gradient(135deg, #1e293b, #334155);
    color: #64b5f6;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.2);
}

.page-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #bfdbfe, #93c5fd);
}

body.ocean-dark-mode .page-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #334155, #475569);
}

.page-display {
    padding: 10px 24px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(21, 101, 192, 0.25);
    font-size: 16px;
    font-weight: 600;
    color: #0d1a26;
    letter-spacing: 1px;
    min-width: 100px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(21, 101, 192, 0.1);
    transition: all 0.3s ease;
}

body.ocean-dark-mode .page-display {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #e2e8f0;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.2);
}

.page-display:hover {
    transform: scale(1.05);
}


/* Table Wrapper */
.table-wrapper {
    overflow-x: auto;
    width: 100%;
}

table {
    min-width: 600px;
}

/* Overlay for mobile */
.ocean-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
    z-index: 998;
}

.ocean-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

body.ocean-dark-mode ::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}

body.ocean-dark-mode ::-webkit-scrollbar-thumb {
    background: rgba(59, 130, 246, 0.3);
}

/* Override for collapsed sidebar */
body:has(.maritime-sidebar.collapsed) .content-area {
    margin-left: 70px;
    width: calc(100% - 70px);
}

body:has(.maritime-sidebar.collapsed) .ocean-top-navbar {
    left: 100px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .maritime-sidebar {
        width: 200px;
    }

    .maritime-sidebar.collapsed {
        width: 80px;
    }


    .maritime-sidebar.collapsed ~ .main-layout .content-area {
        margin-left: 0;
        width: calc(100% - 60px);
    }

    .ocean-top-navbar {
        left: 200px;
    }

    .maritime-sidebar.collapsed ~ .main-layout .ocean-top-navbar {
        left: 60px;
    }

    .dashboard-title {
        font-size: 36px;
    }

    .glass-card {
        padding: 25px;
    }

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

@media (max-width: 768px) {
    .maritime-sidebar {
        left: -240px;
        width: 240px;
    }

    .maritime-sidebar.active {
        left: 0;
    }

    .maritime-sidebar.collapsed {
        width: 60px;
        left: 0;
    }

    .maritime-sidebar.active .ocean-sidebar-toggle {
        right: 0;
    }

    .maritime-sidebar.collapsed .ocean-sidebar-toggle {
        right: -18px;
    }

    .ocean-sidebar-toggle {
        right: -34px;
        top: 15px;
        width: 30px;
        height: 40px;
    }

    .ocean-top-navbar {
        left: 0;
        padding: 0 16px;
    }

    .main-layout .content-area {
        margin-left: 0;
        width: 100%;
        padding: 70px 15px;
    }

    .maritime-sidebar.collapsed ~ .main-layout .content-area {
        margin-left: 60px;
        width: calc(100% - 60px);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .glass-card {
        padding: 20px;
        border-radius: 16px;
        overflow-y: hidden;
    }

    .dashboard-title {
        font-size: 30px;
        letter-spacing: -1px;
    }

    .dashboard-subtitle {
        font-size: 14px;
    }

    .controls-container {
        flex-direction: column;
        align-items: stretch;
    }

    .search-container, .filter-container {
        width: 100%;
    }

    .filter-select {
        width: 100%;
        margin-top: 10px;
    }

    .status-buttons {
        flex-wrap: wrap;
        gap: 8px;
    }

    .status-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .common-table th, .common-table td {
        padding: 12px 15px;
        font-size: 13px;
    }

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

@media (max-width: 480px) {
    .maritime-sidebar {
        width: 200px;
    }

    .maritime-sidebar.collapsed {
        width: 50px;
    }

    .maritime-sidebar.active .ocean-sidebar-toggle {
        right: 0;
    }

    .maritime-sidebar.collapsed .ocean-sidebar-toggle {
        right: -18px;
    }

    .ocean-sidebar-toggle {
        width: 28px;
        height: 36px;
        top: 10px;
    }

    .main-layout .content-area {
        padding: 60px 10px;
    }

    .maritime-sidebar.collapsed ~ .main-layout .content-area {
        margin-left: 50px;
        width: calc(100% - 50px);
    }

    .ocean-top-navbar {
        height: 60px;
        padding: 0 12px;
    }

    .ocean-breadcrumb {
        font-size: 14px;
    }

    .ocean-profile-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }

    .ocean-dropdown-menu {
        width: 180px;
        top: 45px;
        right: 10px;
    }

    .ocean-dropdown-item {
        font-size: 12px;
        padding: 10px 14px;
    }

    .dashboard-title {
        font-size: 24px;
    }

    .dashboard-subtitle {
        font-size: 12px;
    }

    .glass-card {
        padding: 15px;
        border-radius: 12px;
        overflow-y: hidden;
    }

    .card-title {
        font-size: 18px;
    }

    .card-subtitle {
        font-size: 12px;
    }

    .dashboard-grid {
        gap: 10px;
    }

    .common-table th, .common-table td {
        padding: 10px 12px;
        font-size: 12px;
    }

    .status-badge {
        padding: 5px 10px;
        font-size: 11px;
    }

    .search-input, .filter-select {
        font-size: 13px;
        padding: 10px 14px 10px 10px;
    }

    .search-container i, .filter-container i {
        font-size: 14px;
        left: 10px;
    }

    .page-btn, .page-number {
        padding: 6px 10px;
        font-size: 12px;
    }

    .pagination {
        gap: 8px;
    }
}

@media (min-width: 1200px) {
    .maritime-sidebar {
        width: 260px;
    }

    .ocean-top-navbar {
        left: 260px;
    }

    .maritime-sidebar.collapsed ~ .main-layout .content-area {
        margin-left: 0;
        width: calc(100% - 70px);
    }

    .maritime-sidebar.collapsed ~ .main-layout .ocean-top-navbar {
        left: 70px;
    }

    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
        gap: 40px;
    }

    .glass-card {
        padding: 35px;
    }

    .dashboard-title {
        font-size: 48px;
    }
}

/* ------------------------------
   FIX: Mobile alignment for search & filter fields
   ------------------------------ */
@media (max-width: 768px) {
    .search-container,
    .filter-container {
        position: relative;
        display: flex;
        align-items: center;
    }

    .search-container i,
    .filter-container i {
        position: absolute;
        left: 10px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 16px; /* consistent icon size */
        color: #546e7a;
    }

    .filter-container i{
        top: 28px;
    }

    body.ocean-dark-mode .search-container i,
    body.ocean-dark-mode .filter-container i {
        color: #94a3b8;
    }

    .search-input,
    .filter-select {
        padding-left: 34px !important; /* ensure text doesn’t overlap icon */
        line-height: 1.5;
        height: 42px;
        display: flex;
        align-items: center;
    }

    .filter-select {
        background-position: right 10px center !important; /* ensure dropdown arrow aligns */
        background-size: 14px;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .search-container i,
    .filter-container i {
        font-size: 15px;
        left: 8px;
    }

    .search-input,
    .filter-select {
        padding-left: 32px !important;
        height: 38px;
        font-size: 13px;
    }
}

/* Smooth, in-flow sidebar/content animations using CSS variables */
:root {
  --sidebar-expanded-width: 260px;    /* adjust to your preferred desktop width */
  --sidebar-collapsed-width: 80px;    /* collapsed desktop width */
  --sidebar-mobile-width: 240px;      /* width when sidebar overlays on mobile */
  --sidebar-width: var(--sidebar-expanded-width);
  --sidebar-transition: 300ms;
}

/* Sidebar uses variable */
.maritime-sidebar {
  width: var(--sidebar-width);
  transition: width var(--sidebar-transition) ease;
}

/* Top navbar shifts using the same variable */
.ocean-top-navbar {
  left: var(--sidebar-width);
  transition: left var(--sidebar-transition) ease;
}

/* Content shifts in-flow using margin-left based on variable.
   Using margin-left keeps the content flow layout (not an absolutely-positioned element). */
.main-layout {
  transition: margin-left var(--sidebar-transition) ease;
  margin-left: var(--sidebar-width);
  /* ensure stacking doesn't hide shadows */
  position: relative;
  z-index: 1;
}

/* If you prefer to keep .content-area sizing, apply it there instead */
/* .content-area { margin-left: var(--sidebar-width); transition: margin-left var(--sidebar-transition) ease; } */

/* Collapsed state (desktop) — body class toggled by JS */
body.sidebar-collapsed {
  --sidebar-width: var(--sidebar-collapsed-width);
}

/* Mobile default — sidebar hidden, content full width */
@media (max-width: 768px) {
  body {
    --sidebar-width: 0;
  }

  /* When sidebar active on mobile (overlay open), use overlay width */
  body.sidebar-active {
    --sidebar-width: var(--sidebar-mobile-width);
  }

  /* Sidebar transforms instead of instantly jumping left/right */
  .maritime-sidebar {
    left: calc(-1 * var(--sidebar-width)); /* hidden off-canvas when not active */
    transition: left var(--sidebar-transition) ease;
  }
  body.sidebar-active .maritime-sidebar,
  .maritime-sidebar.active {
    left: 0;
  }

  /* Ensure top navbar covers left shift correctly on mobile */
  .ocean-top-navbar {
    left: 0; /* top nav full width normally */
  }

  /* Main layout should not be offset when sidebar overlays unless active */
  .main-layout {
    margin-left: 0;
  }
  body.sidebar-active .main-layout {
    margin-left: var(--sidebar-mobile-width);
  }
}
