:root {
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg-color: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

body {
    font-family: 'Inter', 'Noto Sans TC', sans-serif;
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(37, 99, 235, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.1) 0px, transparent 50%);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
}

.app-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--primary);
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.glass {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 1rem;
    box-shadow: var(--glass-shadow);
}

.container-config {
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.container-config h2 {
    font-size: 1.1rem;
    margin-bottom: 1.25rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

input[type="number"], input[type="text"] {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0.75rem;
    color: white;
    font-size: 1rem;
    transition: border-color 0.2s;
}

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

.capacity-stats {
    margin-top: 1rem;
}

.stat-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.progress-bar-bg {
    height: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-bar-fill {
    height: 100%;
    width: 0%;
    background: var(--primary);
    transition: width 0.4s ease-out, background-color 0.3s;
}

.warning-text {
    color: var(--danger);
    font-size: 0.8rem;
    font-weight: 600;
}

.hidden {
    display: none;
}

.item-list-section {
    margin-bottom: 2rem;
}

.section-header {
    margin-bottom: 1.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.qty-input {
    width: 80px;
    text-align: center;
}

.text-right {
    text-align: right;
}

.total-row {
    font-weight: 700;
    color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.actions {
    display: flex;
    gap: 0.75rem;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-muted);
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
    }
    
    table {
        font-size: 0.9rem;
    }
    
    th, td {
        padding: 0.75rem;
    }
}
/* PDF Export Mode Styles (Used by html2pdf) */
.pdf-mode {
    background: white !important;
    background-image: none !important;
    color: #000 !important;
    padding: 5mm !important;
    font-size: 11px !important;
}

.pdf-mode .glass {
    background: white !important;
    border: 1px solid #ddd !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    color: #000 !important;
    border-radius: 0 !important;
}

.pdf-mode th, .pdf-mode td {
    padding: 6px 10px !important;
    font-size: 10px !important;
}

.pdf-mode h1, .pdf-mode h2, .pdf-mode th, .pdf-mode td, .pdf-mode label, .pdf-mode span, .pdf-mode p {
    color: #000 !important;
}

.pdf-mode input {
    background: white !important;
    color: #000 !important;
    border: 1px solid #ccc !important;
}

.pdf-mode .total-row {
    background: #f1f5f9 !important;
    color: var(--primary) !important;
}

.pdf-mode .progress-bar-bg, .pdf-mode .capacity-stats {
    display: none !important;
}

/* Media Print Styles for PDF Export */
@media print {
    body {
        background: white !important;
        color: black !important;
        font-size: 12px !important;
    }

    .app-container {
        padding: 5mm !important;
        max-width: 100% !important;
    }

    .container-config, #print-btn, #save-pdf-btn, header {
        display: none !important;
    }

    body::before {
        content: "20呎貨櫃費用分攤明細報告";
        display: block;
        font-size: 18px;
        font-weight: bold;
        text-align: center;
        margin-bottom: 10px;
    }

    .glass {
        background: white !important;
        border: 1px solid #ddd !important;
        box-shadow: none !important;
        backdrop-filter: none !important;
        border-radius: 0 !important;
    }

    th, td {
        padding: 8px 10px !important;
        border-bottom: 1px solid #eee !important;
        color: black !important;
        font-size: 11px !important;
    }

    .total-row {
        background: #f8fafc !important;
    }

    .progress-bar-bg, .capacity-stats {
        display: none !important; /* Hide status bars in PDF */
    }

    input.qty-input {
        border: none !important;
        background: transparent !important;
        color: black !important;
        appearance: none;
        -moz-appearance: textfield;
    }
}
