/* ==========================================================================
   MAX'S MAIL - Package Tracking Portal
   Brand Colors: Red #E63946, Navy #1D3557, Off-white #F1FAEE
   ========================================================================== */

:root {
    --primary-color: #E63946;
    --primary-hover: #C1121F;
    --primary-light: #FFCCD5;
    --secondary-color: #1D3557;
    --secondary-light: #457B9D;
    --accent-color: #A8DADC;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --dark: #1D3557;
    --light: #F1FAEE;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(29, 53, 87, 0.1);
    --shadow-lg: 0 10px 25px rgba(29, 53, 87, 0.15);
}

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

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--dark);
    background-color: var(--light);
    min-height: 100vh;
}

/* Navigation */
.navbar {
    background: white;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid var(--primary-color);
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-brand i {
    font-size: 1.75rem;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--secondary-light);
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link:hover {
    color: var(--primary-color);
    background: var(--primary-light);
}

.nav-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.user-welcome {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 999px;
    background: var(--primary-light);
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
}

.logout-btn {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    color: var(--secondary-light);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.logout-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #0D1B2A 100%);
    color: white;
    padding: 4rem 2rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    opacity: 0.5;
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 700px;
    margin: 0 auto;
}

.hero-logo {
    font-size: 4rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.hero-content h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.tagline {
    font-size: 1.2rem;
    opacity: 0.8;
    font-style: italic;
    margin-bottom: 2rem;
}

/* Tracking Search */
.tracking-search {
    max-width: 600px;
    margin: 0 auto;
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 12px;
    padding: 0.5rem;
    box-shadow: var(--shadow-lg);
}

.search-input-wrapper i {
    padding: 0 1rem;
    color: var(--secondary-light);
    font-size: 1.2rem;
}

.search-input-wrapper input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.1rem;
    padding: 0.75rem 0;
    font-family: 'DM Sans', sans-serif;
}

.search-input-wrapper input::placeholder {
    color: #94a3b8;
}

.btn-track {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.875rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
    font-family: 'DM Sans', sans-serif;
}

.btn-track:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

/* Main Container */
.main-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Tracking Results */
.tracking-results {
    margin-bottom: 2rem;
}

.results-card {
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: linear-gradient(135deg, var(--secondary-color) 0%, #0D1B2A 100%);
    color: white;
}

.tracking-info {
    display: flex;
    flex-direction: column;
}

.tracking-label {
    font-size: 0.85rem;
    opacity: 0.8;
    margin-bottom: 0.25rem;
}

.tracking-number {
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.status-badge {
    padding: 0.75rem 1.25rem;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.9rem;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-badge.order_placed { background: #e0e7ff; color: #3730a3; }
.status-badge.picked_up { background: #fef3c7; color: #92400e; }
.status-badge.in_transit { background: #dbeafe; color: #1e40af; }
.status-badge.out_for_delivery { background: #fed7aa; color: #c2410c; }
.status-badge.delivered { background: #d1fae5; color: #065f46; }
.status-badge.return_initiated { background: #fce7f3; color: #9d174d; }
.status-badge.return_in_transit { background: #e0e7ff; color: #4338ca; }
.status-badge.received_at_warehouse { background: #d1fae5; color: #065f46; }

/* Delivery Estimate */
.delivery-estimate {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem 2rem;
    background: var(--primary-light);
    border-bottom: 1px solid var(--border);
}

.delivery-estimate i {
    font-size: 2rem;
    color: var(--primary-color);
}

.estimate-label {
    display: block;
    font-size: 0.85rem;
    color: var(--secondary-light);
}

.estimate-date {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--secondary-color);
}

/* Route Info */
.route-info {
    display: flex;
    align-items: center;
    padding: 1.5rem 2rem;
    gap: 1rem;
}

.route-point {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.route-point i {
    font-size: 1.5rem;
    color: var(--secondary-light);
}

.route-point.destination i {
    color: var(--primary-color);
}

.route-label {
    display: block;
    font-size: 0.75rem;
    color: var(--secondary-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.route-address {
    display: block;
    font-weight: 600;
    color: var(--dark);
    font-size: 0.9rem;
}

.route-line {
    flex: 2;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    position: relative;
}

.route-progress {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    border-radius: 2px;
    transition: width 0.5s ease;
}

/* Visual Timeline */
.visual-timeline {
    padding: 2rem;
    background: #f8fafc;
    border-top: 1px solid var(--border);
}

.timeline-track {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    margin-bottom: 1rem;
    position: relative;
}

.timeline-progress {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--success-color));
    border-radius: 3px;
    transition: width 0.5s ease;
}

.timeline-milestones {
    display: flex;
    justify-content: space-between;
}

.milestone {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex: 1;
    position: relative;
}

.milestone-dot {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
    position: relative;
    z-index: 1;
}

.milestone-dot i {
    font-size: 0.7rem;
    color: white;
    display: none;
}

.milestone.completed .milestone-dot {
    background: var(--success-color);
}

.milestone.completed .milestone-dot i {
    display: block;
}

.milestone.current .milestone-dot {
    background: var(--primary-color);
    box-shadow: 0 0 0 6px rgba(230, 57, 70, 0.2);
}

.milestone.current .milestone-dot i {
    display: block;
}

.milestone-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--secondary-light);
    max-width: 80px;
}

.milestone.completed .milestone-label,
.milestone.current .milestone-label {
    color: var(--dark);
}

.milestone-date {
    font-size: 0.7rem;
    color: var(--secondary-light);
    margin-top: 0.25rem;
}

/* History Section */
.history-section {
    padding: 1.5rem 2rem;
}

.history-section h3 {
    font-size: 1.1rem;
    color: var(--dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.history-section h3 i {
    color: var(--primary-color);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.history-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    position: relative;
}

.history-item:last-child {
    border-bottom: none;
}

.history-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    flex-shrink: 0;
}

.history-item.delivered .history-icon {
    background: #d1fae5;
    color: var(--success-color);
}

.history-content {
    flex: 1;
}

.history-status {
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 0.25rem;
}

.history-description {
    font-size: 0.9rem;
    color: var(--secondary-light);
    margin-bottom: 0.25rem;
}

.history-meta {
    font-size: 0.8rem;
    color: #94a3b8;
    display: flex;
    gap: 1rem;
}

/* Recent Shipments */
.recent-shipments {
    margin-top: 2rem;
}

.recent-shipments h2 {
    font-size: 1.5rem;
    color: var(--dark);
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.recent-shipments h2 i {
    color: var(--primary-color);
}

.shipments-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.25rem;
}

.shipment-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.3s;
}

.shipment-card:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.shipment-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.shipment-tracking {
    font-family: 'Courier New', monospace;
    font-weight: 700;
    color: var(--dark);
    font-size: 1rem;
}

.shipment-type {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

.shipment-type.order {
    background: #dbeafe;
    color: #1e40af;
}

.shipment-type.return {
    background: #fce7f3;
    color: #9d174d;
}

.shipment-status-mini {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.shipment-route {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--secondary-light);
    margin-bottom: 0.75rem;
}

.shipment-route i {
    color: var(--primary-color);
}

.shipment-dates {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #94a3b8;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: 12px;
    border: 2px dashed var(--border);
}

.empty-state i {
    font-size: 4rem;
    color: var(--border);
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.25rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--secondary-light);
    margin-bottom: 1.5rem;
}

/* Admin Section */
.admin-section {
    margin-top: 3rem;
    padding: 1.5rem;
    background: white;
    border-radius: 12px;
    border: 2px solid var(--border);
}

.admin-section h2 {
    font-size: 1.25rem;
    color: var(--dark);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-section h2 i {
    color: var(--warning-color);
}

.admin-note {
    color: var(--secondary-light);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.admin-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

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

.form-group label {
    font-weight: 600;
    color: var(--dark);
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'DM Sans', sans-serif;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    font-family: 'DM Sans', sans-serif;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #e5e7eb;
    color: var(--dark);
}

.btn-secondary:hover {
    background: #d1d5db;
}

/* Footer */
.footer {
    background: var(--secondary-color);
    color: white;
    padding: 2rem;
    margin-top: 3rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.footer-links {
    display: flex;
    gap: 1.5rem;
}

.footer-links a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: white;
}

/* Notification */
.notification {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 1rem 1.5rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.notification.success {
    border-color: var(--success-color);
    border-left: 4px solid var(--success-color);
}

.notification.success i {
    color: var(--success-color);
}

.notification.error {
    border-color: var(--danger-color);
    border-left: 4px solid var(--danger-color);
}

.notification.error i {
    color: var(--danger-color);
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .hero-content h1 {
        font-size: 1.75rem;
    }
    
    .search-input-wrapper {
        flex-direction: column;
        padding: 1rem;
    }
    
    .search-input-wrapper input {
        width: 100%;
        text-align: center;
    }
    
    .btn-track {
        width: 100%;
        justify-content: center;
        margin-top: 0.5rem;
    }
    
    .results-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .route-info {
        flex-direction: column;
    }
    
    .route-line {
        width: 4px;
        height: 40px;
        margin: 0 auto;
    }
    
    .route-progress {
        width: 100% !important;
        height: var(--progress, 0%);
    }
    
    .timeline-milestones {
        flex-direction: column;
        gap: 1rem;
    }
    
    .milestone {
        flex-direction: row;
        text-align: left;
        gap: 1rem;
    }
    
    .shipments-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}
