/*
  DHL Backup Solution - Central Stylesheet v10.5
  แก้ไข Progress Bar ให้แม่นยำและข้อความไม่ตกบรรทัด
  [FIX] แก้ไขปัญหา Scrollbar หาย
*/

/* --- Base and Layout --- */
body {
    font-family: 'Inter', sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f3f4f6;
    color: #1f2937;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}
main { flex-grow: 1; padding: 1rem; }
.container { max-width: 1280px; margin-left: auto; margin-right: auto; padding: 0 1rem; }

/* --- Form Elements & Buttons --- */
.input-field, textarea.input-field {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    background-color: #fff;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.3s ease, color 0.3s ease;
}
.input-field:focus, textarea.input-field:focus {
    outline: none;
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.2);
}
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 0.375rem;
    border: 1px solid transparent;
    transition: all 0.2s ease-in-out;
    cursor: pointer;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-red { background-color: #dc2626; color: white; }
.btn-red:hover:not(:disabled) { background-color: #b91c1c; transform: translateY(-1px); }
.btn-yellow { background-color: #fbbf24; color: #1f2937; }
.btn-yellow:hover:not(:disabled) { background-color: #f59e0b; transform: translateY(-1px); }
.btn-gray { background-color: #e5e7eb; color: #1f2937; }
.btn-gray:hover:not(:disabled) { background-color: #d1d5db; transform: translateY(-1px); }
.utility-button {
    background-color: #e5e7eb;
    color: #374151;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: background-color 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.utility-button:hover { background-color: #d1d5db; }

/* --- Components --- */
.hidden-page, .hidden, .ship-now-step.hidden { display: none !important; }
header, footer { width: 100%; z-index: 10; }
.card {
    background-color: #ffffff;
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    padding: 1.5rem;
}
@media (min-width: 640px) { .card { padding: 2rem; } }

.main-action-button { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    flex: 1;
    padding: 2rem; 
    border-radius: 0.75rem; 
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06); 
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out; 
    cursor: pointer; 
    border: none; 
    min-height: 10rem; 
    text-decoration: none; 
}
.main-action-button:hover { transform: translateY(-4px); box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05); }
.main-action-button svg { width: 3.5rem; height: 3.5rem; margin-bottom: 0.75rem; }
.main-action-button span { font-size: 1.25rem; font-weight: 600; text-align: center; line-height: 1.3; }

/* --- Progress Bar --- */
.progress-bar::before, .progress-line-fill { 
    display: none;
}
.progress-bar { 
    display: flex; 
    justify-content: space-between; 
    align-items: center;
    margin-bottom: 2rem; 
    position: relative; 
}
.progress-step { 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    position: relative; 
    z-index: 2; 
    flex: 0 1 auto;
}
.progress-separator {
    font-size: 1.25rem;
    font-weight: bold;
    color: #d1d5db;
    flex-grow: 1;
    text-align: center;
    transition: color 0.4s ease;
}
.progress-separator.is-complete {
    color: #fbbf24;
}
.step-circle { 
    width: 2.5rem; 
    height: 2.5rem; 
    border-radius: 50%; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    font-weight: bold; 
    border: 2px solid #d1d5db; 
    background-color: #fff; 
    color: #6b7280; 
    transition: all 0.4s ease; 
    flex-shrink: 0;
}
.step-text { 
    font-size: 0.75rem; 
    margin-top: 0.5rem; 
    text-align: center; 
    transition: color 0.4s ease; 
    white-space: nowrap;
    line-height: 1.2;
}
.progress-step.is-active .step-circle { background-color: #dc2626; border-color: #dc2626; color: white; }
.progress-step.is-active .step-text { color: #dc2626; font-weight: 600; }
.progress-step.is-complete .step-circle { background-color: #10B981; border-color: #10B981; color: white; }
.progress-step.is-complete .step-text { color: #4b5563; }
.progress-step .step-number { display: block; }
.progress-step .step-check { display: none; width: 1.5rem; height: 1.5rem; }
.progress-step.is-complete .step-number { display: none; }
.progress-step.is-complete .step-check { display: block; }


/* --- Accordion for Tracking, etc. --- */
.accordion-item { 
    border-bottom: 1px solid #e5e7eb; 
}
.accordion-item:last-child {
    border-bottom: none;
}
.accordion-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 1rem; 
    cursor: pointer; 
    background-color: #f9fafb; 
    transition: background-color 0.2s;
}
.accordion-header:hover {
    background-color: #f3f4f6;
}
.accordion-body { 
    max-height: 0; 
    overflow: hidden; 
    transition: max-height 0.4s ease-out;
    background-color: #ffffff;
}
.accordion-body-content {
    border-top: 1px solid #e5e7eb;
}

/* --- Tracking Timeline (Revised) --- */
.tracking-timeline {
    position: relative;
    padding-left: 1.25rem; /* Space for the line */
    border-left: 2px solid #e5e7eb; /* The vertical line */
}
.timeline-date-header {
    font-weight: 600;
    margin-bottom: 1rem;
    padding-top: 1rem;
}
.timeline-date-header:first-of-type {
    padding-top: 0;
}
.timeline-item {
    position: relative;
    padding-left: 2rem; /* Space between line and text */
    padding-bottom: 1.5rem;
}
.timeline-item:last-child {
    padding-bottom: 0.5rem;
}
.timeline-icon {
    position: absolute;
    left: -0.625rem; /* (Icon width - Border width) / 2 -> (1.25rem - 2px) / 2 */
    top: 4px; /* Adjust vertical alignment */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem; /* 20px */
    height: 1.25rem; /* 20px */
    border-radius: 9999px; /* full */
    background-color: #d1d5db; /* gray-300 */
}
.timeline-item.is-latest .timeline-icon {
    background-color: #10B981; /* green-500 */
    transform: scale(1.1);
}
.timeline-icon svg {
    width: 0.75rem; /* 12px */
    height: 0.75rem; /* 12px */
    color: white;
}
.timeline-content {
    position: relative;
}
.timeline-timestamp {
    font-weight: 500;
    font-size: 0.875rem;
}
.timeline-status {
    font-weight: 600;
    color: #1f2937;
}
.timeline-location {
    font-size: 0.875rem; /* text-sm */
    color: #6b7280; /* gray-500 */
}


/* --- Dark Mode --- */
body.dark-mode { background-color: #111827; color: #d1d5db; }
body.dark-mode header, body.dark-mode footer, body.dark-mode .card { background-color: #1f2937; border-color: #374151; }
body.dark-mode .text-gray-800, body.dark-mode .text-gray-700, body.dark-mode .text-gray-600, body.dark-mode .text-black, body.dark-mode label { color: #d1d5db; }
body.dark-mode .input-field { background-color: #374151; color: #d1d5db; border-color: #4b5563; }
body.dark-mode .input-field:focus { border-color: #fbbf24; }
body.dark-mode .utility-button, body.dark-mode .btn-gray { background-color: #374151; color: #e5e7eb; }
body.dark-mode .utility-button:hover, body.dark-mode .btn-gray:hover:not(:disabled) { background-color: #4b5563; }
body.dark-mode .btn-yellow { background-color: #f59e0b; color: #111827; }
body.dark-mode .bg-yellow-50 { background-color: #1f2937; border-color: #4b5563; }
body.dark-mode .package-piece-item, body.dark-mode .line-item { background-color: #2b374d; border-color: #4b5563; }
body.dark-mode .step-circle { border-color: #4b5563; background-color: #1f2937; color: #9ca3af; }
body.dark-mode .progress-step.is-active .step-text { color: #f87171; }
body.dark-mode .progress-step.is-complete .step-text { color: #d1d5db; }
body.dark-mode .progress-step.is-complete .step-circle { background-color: #10B981; border-color: #10B981; }
body.dark-mode .accordion-header { background-color: #2c374a; }
body.dark-mode .accordion-header:hover { background-color: #374151; }
body.dark-mode .accordion-body { background-color: #1f2937; }
body.dark-mode .accordion-body-content { border-top-color: #374151; }
body.dark-mode .tracking-timeline { border-left-color: #4b5563; }
body.dark-mode .timeline-icon { background-color: #4b5563; }
body.dark-mode .timeline-item.is-latest .timeline-icon { background-color: #10B981; }
body.dark-mode .timeline-status { color: #e5e7eb; }
body.dark-mode .timeline-location { color: #9ca3af; }

/* --- [NEW] Page Layouts & Specific Components --- */

/* Layout for Centered Forms (like Login) */
.layout-centered {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Faded Background Style */
.with-faded-bg {
    position: relative;
    /* overflow: hidden; <-- THIS WAS THE PROBLEM, REMOVED IT */
}

.with-faded-bg::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background-image: url('DBS_Background.jpg');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.1;
}

/* Specific component style for login card */
.login-card {
    max-width: 400px;
    width: 100%;
    z-index: 1; /* Ensure it's above the background */
}
