/* SSM Transport - Application Styles */

:root {
    --p: #405189;
    --p-light: rgba(64, 81, 137, 0.1);
    --g: #6c757d;
    --danger: #dc3545;
    --success: #28a745;
    --warning: #ffc107;
    --dk: #212529;
    --dk2: #495057;
    --r: #dc3545;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 10px;
    --font: 'Noto Sans Thai', sans-serif;
}

* {
    font-family: 'Noto Sans Thai', sans-serif;
}

body {
    background: #f8f9fa;
    margin: 0;
    padding: 0;
}

/* Container */
.container-fluid {
    padding: 1.5rem;
}

/* Navbar */
.app-navbar {
    background: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    padding: 0.5rem 0;
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--p) !important;
}

.nav-link {
    color: #6c757d !important;
    font-weight: 500;
    padding: 0.6rem 1rem !important;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-link:hover {
    background: var(--p-light);
    color: var(--p) !important;
}

.nav-link.active, .menu-item.active {
    background: var(--p);
    color: white !important;
}

/* Buttons */
.btn-p {
    background: var(--p);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-p:hover {
    background: #2d3a5f;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(64, 81, 137, 0.3);
}

.btn-o {
    background: transparent;
    color: var(--p);
    border: 1px solid var(--p);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-o:hover {
    background: var(--p);
    color: white;
}

.btn-sm {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
}

/* Search Box */
.sb {
    position: relative;
    display: flex;
    align-items: center;
}

.sb input {
    padding: 0.5rem 0.75rem 0.5rem 2.5rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    width: 100%;
}

.sb i {
    position: absolute;
    left: 0.75rem;
    color: var(--g);
}

/* Summary Bar */
.summary-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.summary-stats {
    display: flex;
    gap: 2rem;
    font-size: 0.95rem;
}

.summary-stats .hl {
    font-weight: 700;
    color: var(--p);
}

/* Data Grid */
.dg {
    display: grid;
    gap: 1rem;
}

.di label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dk2);
}

.di input, .di select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
}

/* Table Container */
.tc {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Data Table */
.dt {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.dt thead {
    background: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.dt th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--dk);
}

.dt td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9rem;
}

.dt tbody tr:hover {
    background: #f8f9fa;
}

.dt .tr {
    text-align: right;
}

/* Form Elements */
.form-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 0.5rem;
}

.form-control, .form-select {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus, .form-select:focus {
    border-color: #405189;
    box-shadow: 0 0 0 0.2rem rgba(64, 81, 137, 0.15);
    outline: none;
}

.btn {
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background: #405189;
    border: none;
    color: white;
}

.btn-primary:hover {
    background: #2d3a5f;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(64, 81, 137, 0.3);
}

.btn-secondary {
    background: #6c757d;
    border: none;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

/* Summary Card */
.sc {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: transform 0.2s;
}

.sc:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.sc .ico {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.sc .ico.bl { background: rgba(64, 81, 137, 0.1); color: #405189; }
.sc .ico.gr { background: rgba(40, 167, 69, 0.1); color: #28a745; }
.sc .ico.or { background: rgba(255, 193, 7, 0.1); color: #ffc107; }
.sc .ico.rd { background: rgba(220, 53, 69, 0.1); color: #dc3545; }
.sc .ico.pu { background: rgba(111, 66, 193, 0.1); color: #6f42c1; }

.sc .val {
    font-size: 1.8rem;
    font-weight: 700;
    color: #212529;
    margin-bottom: 5px;
}

.sc .lbl {
    font-size: 0.9rem;
    color: #6c757d;
    font-weight: 500;
}

/* Panel */
.pnl {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    height: 100%;
}

.pnl-t {
    font-size: 1.1rem;
    font-weight: 600;
    color: #212529;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #f0f0f0;
}

.cc {
    padding: 10px;
    height: 300px;
    position: relative;
}

.cc-s {
    padding: 10px;
    height: 200px;
    position: relative;
}

/* Page Header */
.page-hdr {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.page-hdr h2 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #212529;
    margin: 0;
}

/* Page Sections */
.ps {
    display: none;
    padding: 20px;
}

.ps.act {
    display: block;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #405189;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: #6c757d;
    font-weight: 500;
}

/* Filter Panel */
.filter-panel {
    background: white;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    overflow: hidden;
}

.filter-toggle {
    padding: 1rem 1.25rem;
    cursor: pointer;
    font-weight: 600;
    color: var(--dk);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.2s;
}

.filter-toggle:hover {
    background: var(--p-light);
}

.filter-toggle i:last-child {
    transition: transform 0.3s;
}

.filter-toggle.open i:last-child {
    transform: rotate(180deg);
}

.filter-body {
    padding: 0 1.25rem 1.25rem;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.filter-toggle.open + .filter-body {
    max-height: 500px;
}

.filter-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.fi {
    flex: 1;
    min-width: 200px;
}

.fi input,
.fi select {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.85rem;
    font-family: 'Noto Sans Thai', sans-serif;
}

.fi input:focus,
.fi select:focus {
    border-color: var(--p);
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(64, 81, 137, 0.15);
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 0.5rem;
    background: white;
    border-radius: 8px;
    padding: 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.view-toggle button {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    color: var(--g);
}

.view-toggle button:hover {
    background: var(--p-light);
    color: var(--p);
}

.view-toggle button.act {
    background: var(--p);
    color: white;
}

/* Ship Grid View */
.ship-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.ship-card {
    background: white;
    border-radius: 10px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.2s;
}

.ship-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Responsive */
@media (max-width: 768px) {
    .sc .val {
        font-size: 1.5rem;
    }
    
    .page-hdr h2 {
        font-size: 1.4rem;
    }
    
    .filter-grid {
        flex-direction: column;
    }
    
    .fi {
        min-width: 100%;
    }
    
    .ship-grid {
        grid-template-columns: 1fr;
    }
}

/* Modal */
.mo {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.mo.show {
    display: flex !important;
}

.mb {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

/* Pagination */
.pgb {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 1rem 0;
}

.pgb button {
    padding: 0.5rem 0.75rem;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.pgb button:hover {
    background: var(--p-light);
    border-color: var(--p);
}

.pgb button.active {
    background: var(--p);
    color: white;
    border-color: var(--p);
}

.pgb button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Toast Container */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
}

/* Dropdown */
.dropdown-menu {
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-radius: 8px;
}

.dropdown-item {
    padding: 0.6rem 1rem;
    transition: all 0.2s;
}

.dropdown-item:hover {
    background: var(--p-light);
    color: var(--p);
}