/* Reset and Variables */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --light-bg: #f8fafc;
    --white: #ffffff;
    --text-dark: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: var(--light-bg);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo span {
    color: var(--danger);
}

.search-bar {
    position: relative;
    flex: 1;
    max-width: 400px;
}

.search-bar input {
    width: 100%;
    padding: 0.75rem 1rem 0.75rem 3rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1rem;
}

.search-btn {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
}

.icon-btn, .profile-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: background 0.2s;
}

.icon-btn:hover, .profile-btn:hover {
    background: var(--light-bg);
}

.profile-dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    right: 0;
    top: 100%;
    background: var(--white);
    box-shadow: var(--shadow-lg);
    border-radius: 8px;
    min-width: 150px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s;
}

.profile-btn:focus + .dropdown-menu,
.profile-dropdown:hover .dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-menu a {
    display: block;
    padding: 0.75rem 1rem;
    text-decoration: none;
    color: var(--text-dark);
    border-radius: 8px;
    transition: background 0.2s;
}

.dropdown-menu a:hover {
    background: var(--light-bg);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-4px);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filters select,
.filter-btn {
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--white);
    font-size: 1rem;
    cursor: pointer;
}

.filter-btn {
    background: var(--primary-color);
    color: var(--white);
    border: none;
    font-weight: 500;
    transition: background 0.2s;
}

.filter-btn:hover {
    background: #1d4ed8;
}

/* Shipments Table */
.shipments h2 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.table-wrapper {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.shipments-table {
    width: 100%;
    border-collapse: collapse;
}

.shipments-table th,
.shipments-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.shipments-table th {
    background: #f1f5f9;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
}

.status {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status.pending { background: #fef3c7; color: var(--warning); }
.status.in-transit { background: #dbeafe; color: var(--primary-color); }
.status.delivered { background: #d1fae5; color: var(--success); }

.action-btn {
    padding: 0.25rem 0.75rem;
    margin-right: 0.5rem;
    border: none;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    margin-bottom: 0.25rem;
}

.action-btn.view {
    background: var(--primary-color);
    color: var(--white);
}

.action-btn.edit {
    background: #f3f4f6;
    color: var(--text-dark);
}

.action-btn:hover {
    opacity: 0.9;
}

/* Modal */
.modal-toggle { display: none; }

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    z-index: 1000;
}

#modal1:checked ~ .modal-overlay {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
    transform: scale(0.8);
    transition: transform 0.3s;
}

#modal1:checked ~ .modal-overlay .modal {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.modal-close:hover {
    background: var(--light-bg);
}

.map-placeholder {
    height: 200px;
    background: linear-gradient(45deg, #e2e8f0, #cbd5e1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--text-light);
    margin-top: 1rem;
}

/* Footer */
.footer {
    background: var(--text-dark);
    color: var(--white);
    text-align: center;
    padding: 2rem 0;
    margin-top: 4rem;
}

/* Responsive Design - Mobile First */

/* Mobile < 768px */
@media (max-width: 767px) {
    .header .container {
        flex-direction: column;
        align-items: stretch;
    }

    .header-left {
        order: 2;
    }

    .header-center {
        order: 1;
        width: 100%;
    }

    .header-right {
        order: 3;
        display: flex;
        justify-content: flex-end;
        gap: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .filters {
        flex-direction: column;
    }

    .filters select,
    .filter-btn {
        width: 100%;
    }

    /* Mobile Table -> Cards */
    .shipments-table {
        display: block;
        width: 100%;
    }

    .shipments-table thead {
        display: none;
    }

    .shipments-table tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid var(--border);
        border-radius: 8px;
        padding: 1rem;
        background: var(--white);
        box-shadow: var(--shadow);
    }

    .shipments-table td {
        display: block;
        padding: 0.5rem 0;
        border: none;
        position: relative;
        padding-left: 50%;
    }

    .shipments-table td:before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        font-weight: 600;
        color: var(--text-light);
    }

    .shipments-table td[data-label="Actions"] {
        padding-left: 1rem;
    }

    .action-btn {
        width: 100%;
        margin-bottom: 0.5rem;
        text-align: center;
    }
}

/* Tablet 768px+ */
@media (min-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop 1024px+ */
@media (min-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .header .container {
        padding: 1.5rem 2rem;
    }

    .shipments-table th,
    .shipments-table td {
        padding: 1.25rem 1.5rem;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
        animation: none !important;
    }
}

:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}
