/* ================================================================================= */
/* File: css/style.css (with Final Fixes) */
/* ================================================================================= */

/* --- Configuration & Reset --- */
:root {
    --primary-color: #5E5DF0;
    --primary-dark: #4a4ac8;
    --secondary-color: #f0f0f0;
    --text-color: #333;
    --text-light: #6c757d;
    --bg-color: #f7f8fc;
    --card-bg: #ffffff;
    --border-color: #e0e0e0;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    --shadow-strong: 0 8px 25px rgba(94, 93, 240, 0.15);
    --border-radius: 12px;
    font-family: 'Poppins', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.bg-gray-100 {
    font-family: 'Inter', sans-serif;
}

.hidden { display: none !important; }

/* --- General Containers & Cards --- */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 0;
}
.card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
}
.text-center { text-align: center; }

/* --- Header --- */
.main-header {
    background-color: var(--card-bg);
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo { font-weight: 700; font-size: 1.5rem; color: var(--primary-color); }
.nav-link { display: flex; align-items: center; gap: 0.5rem; color: var(--primary-color); text-decoration: none; font-weight: 500; transition: color 0.2s ease; }
.nav-link:hover { color: var(--primary-dark); }

/* --- Multi-Step Form Container --- */
.form-container { max-width: 600px; margin: 3rem auto; padding: 0 1rem; }
#report-form { background: var(--card-bg); border-radius: var(--border-radius); padding: 2.5rem; box-shadow: var(--shadow-strong); overflow: hidden; position: relative; }

/* Progress Bar, Form Steps, etc. (omitted for brevity - no changes here) */
.progress-bar { width: 100%; height: 8px; background-color: var(--secondary-color); border-radius: 4px; margin-bottom: 2rem; }
.progress-bar-fill { width: 0%; height: 100%; background-color: var(--primary-color); border-radius: 4px; transition: width 0.4s ease-in-out; }
.form-step { display: none; animation: fadeIn 0.5s ease-in-out; }
.form-step.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.step-title { font-size: 1.8rem; font-weight: 600; margin-bottom: 0.5rem; }
.step-subtitle { font-size: 1rem; color: var(--text-light); margin-bottom: 2rem; }

/* --- Form Elements --- */
.form-group { margin-bottom: 1.5rem; }
.form-group label, .labeled-control label { display: block; margin-bottom: 0.5rem; font-weight: 500; font-size: 0.9rem; }
.form-input { width: 100%; padding: 0.8rem 1rem; border: 1px solid var(--border-color); border-radius: var(--border-radius); font-size: 1rem; font-family: inherit; transition: border-color 0.2s, box-shadow 0.2s; }
.form-input:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(94, 93, 240, 0.2); }
.form-input[readonly] { background-color: #f7f7f7; cursor: not-allowed; }

/* ... other existing styles ... */
.or-divider { text-align: center; margin: 1.5rem 0; color: var(--text-light); font-weight: 500; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.8rem 1.5rem; border: none; border-radius: var(--border-radius); font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.2s ease; text-decoration: none; }
.btn-primary { background-color: var(--primary-color); color: white; box-shadow: 0 4px 10px rgba(94, 93, 240, 0.2); }
.btn-primary:hover { background-color: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 6px 15px rgba(94, 93, 240, 0.3); }
.btn-secondary { background-color: var(--secondary-color); color: var(--text-color); }
.btn-secondary:hover { background-color: #e0e0e0; }
.navigation-buttons { display: flex; justify-content: flex-end; gap: 1rem; margin-top: 2rem; border-top: 1px solid var(--border-color); padding-top: 1.5rem; }
#prev-btn { margin-right: auto; }
.scan-button { width: 100%; padding: 1.5rem; font-size: 1.2rem; background-image: linear-gradient(45deg, var(--primary-color) 0%, #a259ff 100%); color: white; border-radius: var(--border-radius); border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 1rem; transition: all 0.3s ease; }
.scan-button:hover { transform: scale(1.02); box-shadow: var(--shadow-strong); }
.location-group { display: flex; gap: 0.5rem; }
.location-group .form-input { flex-grow: 1; }
.btn-icon { flex-shrink: 0; width: 50px; height: 50px; border-radius: var(--border-radius); border: 1px solid var(--border-color); background-color: white; cursor: pointer; transition: all 0.2s ease; }
.btn-icon:hover { border-color: var(--primary-color); background-color: #f7f8fc; }
.btn-icon svg { color: var(--primary-color); }
.hidden-file-input { display: none; }
.photo-drop-zone { position: relative; border: 2px dashed var(--border-color); border-radius: var(--border-radius); padding: 1rem; text-align: center; cursor: pointer; transition: background-color 0.2s ease; min-height: 120px; display: flex; align-items: center; justify-content: center; }
.photo-drop-zone.dragover { border-color: var(--primary-color); }
.photo-prompt { color: var(--text-light); }
.upload-icon { color: var(--primary-color); }
.photo-preview { max-width: 100%; max-height: 200px; width: auto; height: auto; object-fit: contain; border-radius: var(--border-radius); }
.remove-photo-btn { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border: none; border-radius: 50%; background-color: rgba(0,0,0,0.6); color: white; font-size: 1.2rem; cursor: pointer; }
.signature-pad-wrapper { position: relative; border: 1px solid var(--border-color); border-radius: var(--border-radius); min-height: 100px; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.signature-preview { max-width: 200px; max-height: 80px; }
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.7); display: flex; justify-content: center; align-items: center; z-index: 1000; backdrop-filter: blur(5px); }
.close-modal-btn, .modal-close-btn { position: absolute; top: 1rem; right: 1rem; width: 40px; height: 40px; background: rgba(255,255,255,0.2); color: white; border: none; border-radius: 50%; font-size: 1.5rem; cursor: pointer; line-height: 1; display: flex; align-items: center; justify-content: center; z-index: 10; }
#barcode-scanner video, #barcode-scanner canvas { width: 80vw; max-width: 600px; height: auto; border-radius: var(--border-radius); }
.signature-modal-content { position: relative; background: var(--card-bg); border-radius: var(--border-radius); padding: 2rem; width: 95vw; max-width: 800px; text-align: center; }
#signature-canvas { width: 100%; height: 30vh; border: 1px solid var(--border-color); border-radius: var(--border-radius); margin: 1rem 0; cursor: crosshair; touch-action: none; }
.signature-modal-actions { display: flex; justify-content: flex-end; gap: 1rem; }
.helper-text { font-size: 0.9rem; color: var(--text-light); margin-top: 0.5rem; }
.toast { position: fixed; bottom: 2rem; left: 50%; transform: translateX(-50%); padding: 1rem 2rem; border-radius: var(--border-radius); color: white; font-weight: 500; box-shadow: var(--shadow-strong); z-index: 2000; opacity: 0; transition: all 0.3s ease; }
.toast.show { bottom: 3rem; opacity: 1; }
.toast.success { background-color: var(--success-color); }
.toast.error { background-color: var(--danger-color); }


/* --- Admin Panel Specific Styles --- */
.controls-panel {
    display: flex;
    flex-wrap: wrap; /* Allows items to wrap onto the next line on small screens */
    gap: 1.5rem;
    align-items: flex-end;
    margin-bottom: 2rem;
}
.control-group {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: flex-end;
}
.search-group { flex-grow: 2; min-width: 250px; }
.filter-group { flex-grow: 3; }
.actions-group { flex-grow: 1; }
.labeled-control {
    flex-grow: 1; /* Allows controls to grow and fill space */
    min-width: 150px; /* Prevents controls from becoming too small */
}

.consignment-list { display: grid; gap: 1rem; }
.consignment-item { display: flex; justify-content: space-between; align-items: center; padding: 1.5rem; background: var(--card-bg); border-radius: var(--border-radius); box-shadow: var(--shadow); cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.consignment-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-strong); }
.consignment-item h3 { font-size: 1.2rem; font-weight: 600; color: var(--primary-color); }
.consignment-item p { color: var(--text-light); }
.view-details-arrow { font-size: 1.5rem; color: var(--primary-color); transition: transform 0.2s ease; }
.consignment-item:hover .view-details-arrow { transform: translateX(5px); }

/* --- Admin Modal Styles --- */
.modal-content {
    /* ** THE FIX IS HERE ** */
    background-color: var(--card-bg);
    max-height: 90vh;
    overflow-y: auto;
    padding: 2.5rem;
    width: 90%;
    max-width: 900px;
    border-radius: var(--border-radius);
    position: relative;
}
.modal-header-title { color: var(--text-color); font-size: 1.75rem; font-weight: 700; margin-bottom: 1.5rem; }
.journey-header { font-size: 1.25rem; font-weight: 600; margin-bottom: 1rem; border-bottom: 1px solid var(--border-color); padding-bottom: 0.5rem; }
.journey-visualization { margin-bottom: 2.5rem; }
.timeline-container { overflow-x: auto; padding: 1rem 0; }
.timeline { display: flex; gap: 2rem; position: relative; }
.timeline::before { content: ''; position: absolute; top: 22px; left: 0; right: 0; height: 2px; background: var(--border-color); }
.timeline-item { position: relative; text-align: center; flex: 1; min-width: 150px; }
.timeline-dot { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: 22px; height: 22px; background: var(--card-bg); border: 4px solid var(--primary-color); border-radius: 50%; z-index: 1; }
.timeline-content { margin-top: 3rem; }
.timeline-content h4 { font-weight: 600; }
.timeline-content time { font-size: 0.9rem; color: var(--text-light); }

.log-entry { margin-bottom: 1rem; border: 1px solid var(--border-color); border-radius: var(--border-radius); overflow: hidden; }
.log-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem; background: #f9fafb; cursor: pointer; }
.log-header-arrow { transition: transform 0.3s ease; }
.log-details { padding: 1rem; border-top: 1px solid var(--border-color); display: none; }
.log-details.open { display: block; }
.log-details p { margin-bottom: 0.5rem; }
.log-photo { max-width: 100%; height: auto; margin-top: 1rem; border-radius: var(--border-radius); }

/* --- Responsive Design --- */
@media (max-width: 768px) {
    .controls-panel, .control-group { flex-direction: column; align-items: stretch; }
}

@media (max-width: 640px) {
    .form-container { margin: 1.5rem auto; }
    #report-form { padding: 1.5rem; }
    .step-title { font-size: 1.5rem; }
    .navigation-buttons { flex-direction: column-reverse; }
    .btn { width: 100%; }
    #prev-btn { margin-right: 0; }
}
/* ... at the end of the file ... */

/* --- Admin Panel Item Actions --- */
.consignment-item {
    /* Make the parent a flex container */
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.item-content {
    flex-grow: 1; /* Allows content to take up available space */
}

.item-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-left: 1rem;
}

.delete-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background-color: #fbe9e7; /* Light red background */
    color: var(--danger-color);
    font-size: 1.5rem;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.delete-btn:hover {
    background-color: var(--danger-color);
    color: white;
    transform: scale(1.1);
}
