/* Admin Login Styles */
.admin-login {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.login-container {
    width: 100%;
    max-width: 400px;
}

.login-box {
    background: white;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    padding: 2.5rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.login-header .logo-img {
    height: 50px;
    width: auto;
}

.login-header h1 {
    color: #1e3c72;
    font-size: 1.5rem;
    margin: 0;
}

.login-header h2 {
    color: #1e3c72;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #666;
    margin: 0;
}

.login-form .form-group {
    margin-bottom: 1.5rem;
}

.login-form label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #333;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.login-form label i {
    color: #1e3c72;
}

.login-form input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.login-form input:focus {
    outline: none;
    border-color: #1e3c72;
    box-shadow: 0 0 0 3px rgba(30, 60, 114, 0.1);
}

.btn-block {
    width: 100%;
    padding: 15px;
    font-size: 1.1rem;
    font-weight: 600;
}

.login-footer {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid #eee;
}

.back-link {
    color: #1e3c72;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: #2a5298;
}

/* Admin Dashboard Styles */
.admin-dashboard {
    background: #f8f9fa;
    min-height: 100vh;
}

.admin-header {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.admin-logo img {
    height: 40px;
    width: auto;
}

.admin-logo h1 {
    color: #1e3c72;
    font-size: 1.5rem;
    margin: 0;
}

.admin-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.admin-nav a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.admin-nav a:hover {
    color: #1e3c72;
}

.admin-user {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.admin-user-info {
    text-align: right;
}

.admin-user-name {
    font-weight: 600;
    color: #1e3c72;
    margin: 0;
}

.admin-user-role {
    font-size: 0.9rem;
    color: #666;
    margin: 0;
}

.logout-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s ease;
}

.logout-btn:hover {
    background: #c82333;
}

.admin-main {
    padding: 2rem 0;
}

.admin-sidebar {
    background: white;
    border-radius: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    padding: 1.5rem;
    height: fit-content;
}

.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-menu li {
    margin-bottom: 0.5rem;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 12px 15px;
    color: #333;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: #1e3c72;
    color: white;
}

.sidebar-menu i {
    width: 20px;
    text-align: center;
}

.admin-content {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 2rem;
    margin-bottom: 2rem;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.admin-content h2 {
    color: #1e3c72;
    margin-bottom: 1.5rem;
    border-bottom: 3px solid #1e3c72;
    padding-bottom: 0.75rem;
    font-size: 1.8rem;
    font-weight: 700;
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-content h2::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 50px;
    height: 3px;
    background: linear-gradient(135deg, #2a5298, #1e3c72);
    border-radius: 2px;
}

/* Dashboard Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 10px;
    text-align: center;
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.stat-label {
    font-size: 1rem;
    opacity: 0.9;
}

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    table-layout: fixed;
}

.data-table th,
.data-table td {
    padding: 16px 12px;
    text-align: left;
    border-bottom: 1px solid #e9ecef;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Column widths for better balance */
.data-table th:nth-child(1), .data-table td:nth-child(1) { width: 12%; } /* Tracking Number */
.data-table th:nth-child(2), .data-table td:nth-child(2) { width: 15%; } /* Client */
.data-table th:nth-child(3), .data-table td:nth-child(3) { width: 12%; } /* Origin */
.data-table th:nth-child(4), .data-table td:nth-child(4) { width: 12%; } /* Destination */
.data-table th:nth-child(5), .data-table td:nth-child(5) { width: 10%; } /* Service */
.data-table th:nth-child(6), .data-table td:nth-child(6) { width: 12%; } /* Status */
.data-table th:nth-child(7), .data-table td:nth-child(7) { width: 12%; } /* Location */
.data-table th:nth-child(8), .data-table td:nth-child(8) { width: 10%; } /* Estimated Delivery */
.data-table th:nth-child(9), .data-table td:nth-child(9) { width: 15%; } /* Actions */

.data-table th {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tr:hover {
    background: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.data-table tbody tr {
    transition: all 0.2s ease;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.status-badge {
    padding: 6px 16px;
    border-radius: 25px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.status-badge i {
    font-size: 0.9rem;
}

.status-en_preparation { 
    background: linear-gradient(135deg, #e6a700, #cc9500); 
    color: #fff; 
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.status-en_transit { 
    background: linear-gradient(135deg, #138496, #0f6674); 
    color: #fff; 
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.status-arrive_port { 
    background: linear-gradient(135deg, #1e7e34, #155724); 
    color: #fff; 
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.status-dedouanement { 
    background: linear-gradient(135deg, #dc3545, #c82333); 
    color: #fff; 
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.status-en_livraison { 
    background: linear-gradient(135deg, #495057, #343a40); 
    color: #fff; 
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.status-livre { 
    background: linear-gradient(135deg, #155724, #0f5132); 
    color: #fff; 
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Additional status styles for all possible values */
.status-enregistre { 
    background: linear-gradient(135deg, #6f42c1, #5a32a3); 
    color: #fff; 
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.status-en_transit_maritime { 
    background: linear-gradient(135deg, #0056b3, #004085); 
    color: #fff; 
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.status-en_transit_aerien { 
    background: linear-gradient(135deg, #e55a00, #cc4a00); 
    color: #fff; 
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.status-en_transit_terrestre { 
    background: linear-gradient(135deg, #8b4513, #6b3410); 
    color: #fff; 
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.status-arrive_au_port { 
    background: linear-gradient(135deg, #1e7e34, #155724); 
    color: #fff; 
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.status-arrive_a_destination { 
    background: linear-gradient(135deg, #28a745, #1e7e34); 
    color: #fff; 
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.status-en_cours_de_dedouanement { 
    background: linear-gradient(135deg, #dc3545, #c82333); 
    color: #fff; 
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.status-retarde { 
    background: linear-gradient(135deg, #fd7e14, #e55a00); 
    color: #fff; 
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}
.status-probleme_detecte { 
    background: linear-gradient(135deg, #dc3545, #c82333); 
    color: #fff; 
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Default status for empty or unknown values */
.status-badge:not([class*="status-"]),
.status-default {
    background: linear-gradient(135deg, #6c757d, #495057); 
    color: #fff; 
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.btn-small {
    padding: 8px 12px;
    font-size: 0.85rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
}

.btn-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-edit {
    background: #ffc107;
    color: #212529;
}

.btn-edit:hover {
    background: #e0a800;
}

.btn-delete {
    background: #dc3545;
    color: white;
}

.btn-delete:hover {
    background: #c82333;
}

.btn-view {
    background: #17a2b8;
    color: white;
}

.btn-view:hover {
    background: #138496;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #138496;
}

/* Forms */
.admin-form {
    max-width: 800px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #1e3c72;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Form field styling */
.form-group input[type="date"] {
    padding: 11px 12px;
}

.form-group input[type="number"] {
    padding: 11px 12px;
}

.form-group input[type="email"],
.form-group input[type="tel"] {
    padding: 11px 12px;
}

/* Placeholder styling */
.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #999;
    font-style: italic;
}

/* Text muted class */
.text-muted {
    color: #6c757d;
    font-style: italic;
}

/* Form help text */
.form-help {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: #6c757d;
    font-style: italic;
}

/* Shipment Details View */
.shipment-details {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 2rem;
}

.detail-section {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.detail-section h3 {
    color: #1e3c72;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.detail-item.full-width {
    grid-column: 1 / -1;
}

.detail-item label {
    font-weight: 600;
    color: #333;
    font-size: 0.9rem;
}

.detail-value {
    color: #666;
    font-size: 1rem;
    line-height: 1.4;
}

.detail-value.text-muted {
    color: #6c757d;
    font-style: italic;
}

/* History Management Styles */
.shipment-selector {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    border: 2px dashed #1e3c72;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.search-container {
    max-width: 600px;
    margin: 0 auto;
    position: relative;
}

.search-container label {
    font-weight: 600;
    color: #1e3c72;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    display: block;
}

.search-input-group {
    position: relative;
    margin-bottom: 0;
}

.search-input-group input {
    width: 100%;
    padding: 15px 50px 15px 20px;
    border: 2px solid #1e3c72;
    border-radius: 10px;
    font-size: 1rem;
    background: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(30, 60, 114, 0.1);
}

.search-input-group input:focus {
    outline: none;
    border-color: #2a5298;
    box-shadow: 0 4px 15px rgba(30, 60, 114, 0.2);
    transform: translateY(-2px);
}

.search-input-group input::placeholder {
    color: #999;
    font-style: italic;
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #1e3c72;
    font-size: 1.1rem;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #1e3c72;
    border-top: none;
    border-radius: 0 0 10px 10px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    display: none;
}

.search-result-item {
    padding: 12px 20px;
    border-bottom: 1px solid #e9ecef;
    cursor: pointer;
    transition: background 0.2s ease;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #f8f9fa;
}

.result-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.result-main strong {
    color: #1e3c72;
    font-size: 1rem;
}

.customer-name {
    color: #666;
    font-size: 0.9rem;
}

.result-details {
    font-size: 0.8rem;
    color: #999;
}

.route {
    font-style: italic;
}

.no-results {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* Scrollbar styling for search results */
.search-results::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb {
    background: #1e3c72;
    border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb:hover {
    background: #2a5298;
}

.shipment-info-card {
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 25px rgba(30, 60, 114, 0.3);
}

.shipment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.shipment-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
}

.shipment-details p {
    margin: 0.5rem 0;
    opacity: 0.9;
}

.add-event-section {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    position: relative;
    overflow: hidden;
}

.add-event-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
}

.add-event-section h3 {
    color: #1e3c72;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.75rem;
    font-size: 1.4rem;
    font-weight: 600;
    position: relative;
}

.add-event-section h3::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 50px;
    height: 2px;
    background: linear-gradient(135deg, #1e3c72, #2a5298);
}

.history-timeline {
    background: white;
    border-radius: 15px;
    padding: 2rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}

.history-timeline h3 {
    color: #1e3c72;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

.no-history, .no-selection {
    text-align: center;
    padding: 4rem 2rem;
    color: #6c757d;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 15px;
    border: 2px dashed #dee2e6;
    margin: 2rem 0;
}

.no-history i, .no-selection i {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.3;
    color: #1e3c72;
}

.no-history h3, .no-selection h3 {
    margin-bottom: 1rem;
    color: #1e3c72;
    font-size: 1.5rem;
    font-weight: 600;
}

.no-history p, .no-selection p {
    font-size: 1.1rem;
    line-height: 1.6;
    max-width: 500px;
    margin: 0 auto;
}

.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, #1e3c72, #2a5298);
    border-radius: 1px;
}

.timeline-item {
    position: relative;
    margin-bottom: 2rem;
    padding-left: 2rem;
}

.timeline-item.latest {
    margin-bottom: 3rem;
}

.timeline-marker {
    position: absolute;
    left: -1.5rem;
    top: 0.5rem;
    width: 12px;
    height: 12px;
    background: #1e3c72;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 0 3px #1e3c72;
}

.timeline-item.latest .timeline-marker {
    background: #28a745;
    box-shadow: 0 0 0 3px #28a745;
    transform: scale(1.2);
}

.timeline-content {
    background: #f8f9fa;
    border-radius: 10px;
    padding: 1.5rem;
    border-left: 4px solid #1e3c72;
    transition: all 0.3s ease;
}

.timeline-item.latest .timeline-content {
    background: white;
    border-left-color: #28a745;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.timeline-header h4 {
    margin: 0;
    color: #1e3c72;
    font-weight: 600;
    font-size: 1.1rem;
}

.timeline-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.timeline-date {
    color: #6c757d;
    font-size: 0.9rem;
    font-weight: 500;
}

.timeline-location {
    color: #495057;
    margin: 0.5rem 0;
    font-weight: 500;
}

.timeline-location i {
    color: #1e3c72;
    margin-right: 0.5rem;
}

.timeline-description {
    color: #6c757d;
    margin: 1rem 0;
    line-height: 1.5;
}

.timeline-user {
    color: #adb5bd;
    font-size: 0.8rem;
    font-style: italic;
}

/* Alert Styles */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    border: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.alert-success {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.alert-error {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

.alert i {
    font-size: 1.2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .admin-nav {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .data-table {
        font-size: 0.9rem;
        table-layout: auto;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px;
    }
    
    /* Remove fixed column widths on mobile */
    .data-table th:nth-child(n),
    .data-table td:nth-child(n) {
        width: auto;
    }
    
    .admin-content {
        padding: 1rem;
        margin: 1rem;
    }
    
    .admin-content h2 {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
}
