/* ========================================
   SGTD TMS Application - Unified Styles
   ======================================== */

/* ========================================
   BASE STYLES
   ======================================== */

/* Reset & Base */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: linear-gradient(-45deg, #667eea, #764ba2, #4facfe, #00f2fe);
    background-size: 400% 400%;
    animation: gradient 15s ease infinite;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: white;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

/* Override centering for long content */
@media screen and (max-height: 800px) {
    body {
        justify-content: flex-start;
    }
}

@keyframes gradient {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* ========================================
   FEE SECTION STYLES
   ======================================== */

.fee-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
    min-height: 48px;
}

.fee-label {
    flex: 1;
    width: 50%;
    display: flex;
    align-items: center;
}

.fee-row input[type="number"] {
    flex: 1;
    width: 50%;
    margin-bottom: 0;
}

.fee-label input[type="checkbox"] {
    margin-right: 8px;
}

/* ========================================
   LOGO & BRANDING
   ======================================== */

.logo {
    width: 200px;
    height: auto;
    margin-bottom: 20px;
}

/* ========================================
   TYPOGRAPHY
   ======================================== */

h1,
h2,
h3,
h4 {
    text-align: center;
    margin-bottom: 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

h1 {
    font-size: 32px;
    font-weight: 400;
}

h2 {
    font-size: 26px;
    font-weight: 500;
}

h3 {
    font-size: 22px;
    font-weight: 600;
}

h4 {
    font-size: 20px;
    font-weight: 600;
}

/* Typography inside containers */
.page-container h1,
.page-container h2,
.page-container h3,
.page-container h4 {
    color: #1f2937;
    text-shadow: none;
    font-weight: 600;
}

.form-container h1,
.form-container h2,
.form-container h3,
.form-container h4 {
    color: #1f2937;
    text-shadow: none;
    font-weight: 600;
}

/* ========================================
   LAYOUT CONTAINERS
   ======================================== */

.page-container {
    margin: 0 auto;
    padding: 40px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    border-radius: 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: #2c3e50;
    text-align: center;
}

.page-container--narrow {
    max-width: 500px;
}

.page-container--standard {
    max-width: 600px;
}

.page-container--wide {
    max-width: 800px;
}

.page-container--full {
    width: 100%;
    max-width: none;
}

.page-container--error {
    background: rgba(255, 245, 245, 0.95);
}

.form-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    border-radius: 20px;
    text-align: left;
    width: 100%;
}

/* Form labels need better contrast on gradient background */
.form-container label {
    color: #1f2937;
    font-weight: 600;
}

/* ========================================
   FORM ELEMENTS
   ======================================== */

label {
    display: block;
    margin-bottom: 12px;
    font-weight: 600;
    color: #1f2937;
    text-align: left;
    font-size: 15px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Checkbox Labels */
label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    max-width: 100%;
    word-wrap: break-word;
    flex-wrap: wrap;
}

input[type="checkbox"] {
    margin: 0;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

input,
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 16px;
    border: 2px solid #e1e8ef;
    border-radius: 12px;
    text-align: center;
    font-size: 15px;
    background: rgba(255, 255, 255, 0.95);
    color: #1f2937;
    transition: all 0.3s ease;
    height: 48px;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Placeholder styling */
input::placeholder,
textarea::placeholder {
    color: #9ca3af;
    opacity: 1;
}

/* Style hidden option to match placeholder appearance */
select option[disabled][selected][hidden] {
    color: #9ca3af;
}

/* Additional styling for select with hidden placeholder option */
select:invalid {
    color: #9ca3af;
}

/* Custom arrow styling for regular select elements to match Select2 */
select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23667eea' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px 16px;
    padding-right: 40px;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1), 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
}

/* File input styling - clean design without redundant button */
input[type="file"] {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px dashed #e1e8ef;
    border-radius: 12px;
    color: transparent;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 48px;
    position: relative;
}

input[type="file"]:hover {
    border-color: #667eea;
    background: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    border-style: solid;
}

input[type="file"]:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    transform: translateY(-1px);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1), 0 4px 12px rgba(102, 126, 234, 0.15);
    border-style: solid;
}

/* Hide the default file selector button */
input[type="file"]::file-selector-button {
    display: none;
}

/* Add upload icon and text as visual cue */
input[type="file"]::after {
    content: "🗂️\00a0\00a0\00a0Select file";
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: #6b7280;
    font-size: 15px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Style for when file is selected - this will be handled by JavaScript */
input[type="file"].has-file {
    border-style: solid;
    border-color: #22c55e;
    background: rgba(34, 197, 94, 0.05);
}

input[type="file"].has-file::after {
    content: "📁\00a0\00a0\00a0" attr(data-filename);
    color: #22c55e;
}

/* Special form inputs */
.input--centered {
    width: 300px;
    height: 42px;
    text-align: center;
    padding: 10px 16px;
}

.input--medium {
    width: 350px;
    height: 30px;
}

.input--small {
    width: 230px;
    height: 30px;
}

/* Select2 Dropdown Styling */
.select2-container {
    width: 100% !important;
}

.select2-container .select2-selection--single {
    height: 48px !important;
    border: 2px solid #e1e8ef !important;
    border-radius: 12px !important;
    background: rgba(255, 255, 255, 0.95) !important;
    transition: all 0.3s ease !important;
}

.select2-container .select2-selection--single .select2-selection__rendered {
    color: #1f2937 !important;
    line-height: 44px !important;
    padding-left: 16px !important;
    font-size: 15px !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.select2-container .select2-selection--single .select2-selection__arrow {
    height: 44px !important;
    right: 12px !important;
}

.select2-container .select2-selection--single .select2-selection__arrow b {
    border-color: #667eea transparent transparent transparent !important;
    border-width: 6px 6px 0 6px !important;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
    border-color: transparent transparent #667eea transparent !important;
    border-width: 0 6px 6px 6px !important;
}

.select2-container--default .select2-selection--single:focus,
.select2-container--default.select2-container--open .select2-selection--single {
    border-color: #667eea !important;
    background: rgba(255, 255, 255, 1) !important;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1), 0 4px 12px rgba(102, 126, 234, 0.15) !important;
    transform: translateY(-1px) !important;
}

.select2-dropdown {
    border: 2px solid #667eea !important;
    border-radius: 12px !important;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2) !important;
    backdrop-filter: blur(10px) !important;
    background: rgba(255, 255, 255, 0.98) !important;
    margin-top: 4px !important;
}

.select2-container--default .select2-results__option {
    color: #1f2937 !important;
    background: transparent !important;
    padding: 14px 16px !important;
    font-size: 15px !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    transition: all 0.2s ease !important;
}

.select2-container--default .select2-results__option--highlighted {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%) !important;
    color: #667eea !important;
    font-weight: 600 !important;
}

.select2-container--default .select2-results__option[aria-selected="true"] {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%) !important;
    color: #667eea !important;
    font-weight: 600 !important;
}

.select2-container--default .select2-results__option[aria-selected="true"].select2-results__option--highlighted {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2) 0%, rgba(118, 75, 162, 0.2) 100%) !important;
    color: #667eea !important;
}

.select2-search--dropdown .select2-search__field {
    border: 2px solid #e1e8ef !important;
    border-radius: 8px !important;
    padding: 8px 12px !important;
    font-size: 15px !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    color: #1f2937 !important;
}

.select2-search--dropdown .select2-search__field:focus {
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
    outline: none !important;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    margin: 8px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    letter-spacing: 0.025em;
}

.btn:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.5);
}

.btn--success {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.4);
}

.btn--success:hover {
    box-shadow: 0 10px 30px rgba(79, 172, 254, 0.5);
    transform: translateY(-3px) scale(1.02);
}

.btn--error {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.btn--error:hover {
    box-shadow: 0 10px 30px rgba(255, 107, 107, 0.5);
    transform: translateY(-3px) scale(1.02);
}

.btn--warning {
    background: linear-gradient(135deg, #ff9a56 0%, #ff6b6b 100%);
    box-shadow: 0 4px 15px rgba(255, 154, 86, 0.3);
}

.btn--warning:hover {
    box-shadow: 0 6px 20px rgba(255, 154, 86, 0.4);
}

.btn-container {
    text-align: center;
    margin-top: 30px;
}

/* ========================================
   MESSAGE COMPONENTS
   ======================================== */

.message-box {
    text-align: center;
    font-size: 18px;
    margin-bottom: 32px;
    font-weight: 600;
    padding: 24px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.message-box--info {
    color: #1e40af;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(37, 99, 235, 0.1) 100%);
    border-left: 4px solid #3b82f6;
}

.message-box--error {
    color: #dc2626;
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(220, 38, 38, 0.1) 100%);
    border-left: 4px solid #ef4444;
}

.message-box--success {
    color: #059669;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(5, 150, 105, 0.1) 100%);
    border-left: 4px solid #22c55e;
}

.message-icon {
    font-size: 64px;
    margin-bottom: 20px;
    filter: drop-shadow(0 2px 4px rgba(231, 76, 60, 0.3));
}

.instructions {
    font-size: 16px;
    margin: 20px 0;
    color: #6c757d;
    line-height: 1.6;
    background: rgba(108, 117, 125, 0.1);
    padding: 16px;
    border-radius: 8px;
}

/* ========================================
   STATUS LISTS
   ======================================== */

.status-section {
    margin-bottom: 30px;
}

.status-list {
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    text-align: left;
}

.status-list--success {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15) 0%, rgba(5, 150, 105, 0.1) 100%);
    border: 1px solid rgba(34, 197, 94, 0.2);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 25px rgba(34, 197, 94, 0.15);
}

.status-list--error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.15) 0%, rgba(220, 38, 38, 0.1) 100%);
    border: 1px solid rgba(239, 68, 68, 0.2);
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.15);
}

.status-item {
    margin-bottom: 8px;
    padding: 5px 0;
    font-weight: 500;
}

.status-item--success {
    color: #059669;
}

.status-item--error {
    color: #dc2626;
}

.status-title--success {
    color: #059669;
}

.status-title--error {
    color: #dc2626;
}

/* ========================================
   FORM-SPECIFIC COMPONENTS
   ======================================== */

.company-section {
    margin-bottom: 40px;
    padding-bottom: 30px;
}

/* Add File Button Styling */
#addButtonContainer0 button,
#addButtonContainer1 button,
#addButtonContainer2 button,
#addButtonContainer3 button,
#addButtonContainer4 button,
[id*="addButtonContainer"] button {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%) !important;
    color: white !important;
    border: none !important;
    padding: 12px 24px !important;
    border-radius: 10px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3) !important;
    letter-spacing: 0.025em !important;
    margin: 16px 0 8px 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
}

#addButtonContainer0 button:hover,
#addButtonContainer1 button:hover,
#addButtonContainer2 button:hover,
#addButtonContainer3 button:hover,
#addButtonContainer4 button:hover,
[id*="addButtonContainer"] button:hover {
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.4) !important;
}

#addButtonContainer0 button:active,
#addButtonContainer1 button:active,
#addButtonContainer2 button:active,
#addButtonContainer3 button:active,
#addButtonContainer4 button:active,
[id*="addButtonContainer"] button:active {
    transform: translateY(-1px) scale(1.01) !important;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.5) !important;
}

/* Add a subtle icon to the Add button */
#addButtonContainer0 button::before,
#addButtonContainer1 button::before,
#addButtonContainer2 button::before,
#addButtonContainer3 button::before,
#addButtonContainer4 button::before,
[id*="addButtonContainer"] button::before {
    content: "+" !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    margin-right: 4px !important;
}

/* File input containers */
#fileInputsContainer_0,
#fileInputsContainer_1,
#fileInputsContainer_2,
#fileInputsContainer_3,
#fileInputsContainer_4,
[id*="fileInputsContainer"] {
    margin: 16px 0 !important;
}

[id*="fileInputsContainer"] label {
    margin-top: 16px !important;
    margin-bottom: 8px !important;
    font-weight: 600 !important;
    color: #1f2937 !important;
}

[id*="fileInputsContainer"] input[type="file"] {
    margin-bottom: 16px !important;
}

/* Remove default hr styling */
hr {
    display: none;
}

.truck-input-group {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin-bottom: 16px;
}

.truck-input-group input[type="text"] {
    flex: 1;
    margin-bottom: 0;
}

.truck-input-group input[type="file"] {
    width: auto;
    flex-shrink: 0;
    margin-bottom: 0;
}

.billing-fields {
    display: flex;
    gap: 20px;
    margin-bottom: 16px;
}

.billing-fields--hidden {
    display: none;
}

/* Navigation */
.nav-arrows {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    left: 20px;
    right: 20px;
    z-index: 10;
    pointer-events: none;
}

#prevButton {
    position: absolute;
    left: 0;
}

#nextButton {
    position: absolute;
    right: 0;
}

.nav-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 12px 20px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    pointer-events: all;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-btn:hover {
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.page-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    border-radius: 25px;
    color: white;
    font-weight: 600;
    z-index: 1000;
}

.loading-overlay {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: none;
    z-index: 1000;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

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

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

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

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.hidden {
    display: none;
}

.block {
    display: block;
}

.flex {
    display: flex;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .page-content-wrapper {
        padding: 20px 15px;
    }

    .page-container {
        max-width: 95% !important;
        margin: 0 auto;
        padding: 20px;
    }

    .form-container {
        padding: 25px;
    }

    .btn {
        display: block;
        width: 100%;
        margin: 5px 0;
    }

    .input--centered,
    .input--medium,
    .input--small {
        width: 100%;
    }

    .billing-fields {
        flex-direction: column;
        gap: 0;
    }

    .truck-input-group {
        flex-direction: column;
        gap: 0;
    }
}

@media (max-width: 480px) {
    .page-content-wrapper {
        padding: 15px 10px;
    }

    h1 {
        font-size: 24px;
    }

    h2 {
        font-size: 20px;
    }

    .page-container {
        padding: 15px;
        max-width: 98% !important;
    }

    .form-container {
        padding: 20px;
    }

    .nav-arrows {
        position: relative;
        width: 100%;
        padding: 20px 0;
    }
}