:root {
    --primary: #1a56db;
    --primary-dark: #1e40af;
    --primary-light: #3b82f6;
    --secondary: #f97316;
    --secondary-dark: #ea580c;
    --success: #16a34a;
    --warning: #ca8a04;
    --danger: #dc2626;
    --info: #0891b2;
    
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    
    --sidebar-width: 260px;
    --header-height: 64px;
    --border-radius: 8px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--gray-800);
    background: var(--gray-100);
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    height: auto;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

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

.btn-secondary:hover {
    background: var(--secondary-dark);
}

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

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

.btn-outline {
    background: transparent;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 16px;
}

.btn-block {
    width: 100%;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--gray-700);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

select.form-control {
    cursor: pointer;
}

.input-group {
    display: flex;
}

.input-group .form-control {
    border-radius: var(--border-radius) 0 0 var(--border-radius);
}

.input-group .btn {
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin-bottom: 16px;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border: 1px solid #86efac;
}

.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: #fef9c3;
    color: #854d0e;
    border: 1px solid #fde047;
}

.alert-info {
    background: #e0f2fe;
    color: #075985;
    border: 1px solid #7dd3fc;
}

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

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-800);
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--gray-200);
    background: var(--gray-50);
}

.table-wrapper {
    overflow-x: auto;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.table th {
    font-weight: 600;
    color: var(--gray-600);
    background: var(--gray-50);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table tbody tr:hover {
    background: var(--gray-50);
}

.table-actions {
    display: flex;
    gap: 8px;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 20px;
}

.badge-pending { background: #fef9c3; color: #854d0e; }
.badge-processing { background: #dbeafe; color: #1e40af; }
.badge-purchased { background: #e0f2fe; color: #075985; }
.badge-shipped { background: #d1fae5; color: #065f46; }
.badge-transit { background: #fef3c7; color: #92400e; }
.badge-arrived { background: #fce7f3; color: #9d174d; }
.badge-ready { background: #d1fae5; color: #047857; }
.badge-delivered { background: #dcfce7; color: #166534; }
.badge-cancelled { background: #fee2e2; color: #991b1b; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-inactive { background: #f3f4f6; color: #6b7280; }
.badge-confirmed { background: #dcfce7; color: #166534; }
.badge-failed { background: #fee2e2; color: #991b1b; }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.blue { background: #dbeafe; color: var(--primary); }
.stat-icon.orange { background: #ffedd5; color: var(--secondary); }
.stat-icon.green { background: #dcfce7; color: var(--success); }
.stat-icon.red { background: #fee2e2; color: var(--danger); }

.stat-info h4 {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-800);
}

.stat-info p {
    color: var(--gray-500);
    font-size: 13px;
}

.layout-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--gray-900);
    color: white;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    text-align: center;
}

.sidebar-logo {
    max-height: 50px;
    margin-bottom: 8px;
}

.sidebar-brand {
    font-size: 18px;
    font-weight: 700;
    color: white;
}

.sidebar-nav {
    padding: 16px 0;
}

.nav-item {
    display: block;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--gray-400);
    font-size: 14px;
    transition: all 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255,255,255,0.1);
    color: white;
}

.nav-link i {
    width: 20px;
    text-align: center;
}

.nav-section {
    padding: 8px 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-500);
    margin-top: 16px;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.header {
    background: white;
    height: var(--header-height);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--gray-200);
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.page-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--gray-800);
}

.page-content {
    padding: 24px;
}

.tracking-timeline {
    position: relative;
    padding-left: 30px;
}

.tracking-timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gray-300);
}

.timeline-item {
    position: relative;
    padding-bottom: 24px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--gray-300);
    border: 2px solid white;
}

.timeline-item.completed::before {
    background: var(--success);
}

.timeline-item.current::before {
    background: var(--primary);
    box-shadow: 0 0 0 4px rgba(26, 86, 219, 0.2);
}

.timeline-content {
    background: white;
    padding: 16px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.timeline-date {
    font-size: 12px;
    color: var(--gray-500);
    margin-bottom: 4px;
}

.timeline-title {
    font-weight: 600;
    color: var(--gray-800);
    margin-bottom: 4px;
}

.timeline-desc {
    color: var(--gray-600);
    font-size: 13px;
}

.chat-container {
    display: flex;
    height: calc(100vh - var(--header-height) - 48px);
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.chat-sidebar {
    width: 280px;
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
}

.chat-user-list {
    flex: 1;
    overflow-y: auto;
}

.chat-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.chat-user:hover,
.chat-user.active {
    background: var(--gray-50);
}

.chat-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

.chat-user-info h4 {
    font-size: 14px;
    font-weight: 500;
}

.chat-user-info p {
    font-size: 12px;
    color: var(--gray-500);
}

.unread-badge {
    background: var(--danger);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: auto;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.chat-header {
    padding: 16px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    gap: 12px;
}

.chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: var(--border-radius);
    position: relative;
}

.message.sent {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.received {
    align-self: flex-start;
    background: var(--gray-100);
    color: var(--gray-800);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
}

.message-attachment {
    margin-top: 8px;
    padding: 8px;
    background: rgba(0,0,0,0.1);
    border-radius: 6px;
}

.chat-input {
    padding: 16px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 12px;
}

.chat-input input {
    flex: 1;
}

.chat-input input[type="file"] {
    display: none;
}

.landing-hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 80px 0;
    text-align: center;
}

.landing-hero h1 {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 16px;
}

.landing-hero p {
    font-size: 20px;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 32px;
}

.landing-features {
    padding: 80px 0;
    background: white;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.feature-card {
    text-align: center;
    padding: 32px;
}

.feature-icon {
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 16px;
}

.feature-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.feature-card p {
    color: var(--gray-600);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: var(--border-radius);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(-20px);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray-500);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.pagination {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-top: 24px;
}

.pagination a,
.pagination span {
    padding: 8px 14px;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    color: var(--gray-700);
}

.pagination a:hover {
    background: var(--gray-50);
}

.pagination .active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-500);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--gray-700);
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-primary { color: var(--primary); }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 16px; }
.gap-1 { gap: 8px; }

/* Mobile Navigation */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    color: var(--gray-700);
}

.mobile-close-btn {
    display: none;
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 28px;
    color: white;
    cursor: pointer;
    z-index: 101;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

@media (max-width: 1024px) {
    .mobile-menu-btn {
        display: block;
    }
    
    .mobile-close-btn {
        display: block;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .header {
        padding: 0 16px;
    }
    
    .page-content {
        padding: 16px;
    }
    
    .page-title {
        font-size: 18px;
    }
}

@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .container,
    .container-fluid {
        padding-left: 16px;
        padding-right: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .stat-card {
        padding: 16px;
        flex-direction: row;
        gap: 12px;
    }
    
    .stat-icon {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
    
    .stat-info h4 {
        font-size: 20px;
    }
    
    .stat-info p {
        font-size: 12px;
    }
    
    .card {
        margin-bottom: 16px;
    }
    
    .card-header {
        padding: 12px 16px;
    }
    
    .card-body {
        padding: 16px;
    }
    
    .table-wrapper {
        -webkit-overflow-scrolling: touch;
        margin: 0 -16px;
        padding: 0 16px;
        overflow-x: auto;
    }
    
    .table {
        min-width: 600px;
        font-size: 13px;
    }
    
    .table th,
    .table td {
        padding: 10px 12px;
    }
    
    .form-group {
        margin-bottom: 16px;
    }
    
    .form-label {
        font-size: 14px;
        margin-bottom: 8px;
    }
    
    .form-control {
        padding: 14px 12px;
        font-size: 16px;
        min-height: 48px;
    }
    
    .btn {
        padding: 14px 20px;
        font-size: 15px;
        min-height: 48px;
        width: 100%;
        justify-content: center;
    }
    
    .btn-sm {
        padding: 10px 16px;
        font-size: 13px;
        min-height: 40px;
    }
    
    .btn-lg {
        padding: 16px 24px;
        font-size: 16px;
    }
    
    [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    [style*="grid-template-columns: 1fr 2fr"] {
        grid-template-columns: 1fr !important;
    }
    
    .chat-container {
        flex-direction: column;
        height: calc(100vh - var(--header-height));
    }
    
    .chat-sidebar {
        width: 100%;
        height: 100%;
    }
    
    .landing-hero {
        padding: 60px 20px;
    }
    
    .landing-hero h1 {
        font-size: 28px;
    }
    
    .landing-hero p {
        font-size: 16px;
    }
    
    .landing-features {
        padding: 40px 16px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        padding: 0 16px;
    }
    
    .hide-mobile {
        display: none !important;
    }
    
    .show-mobile-only {
        display: block !important;
    }
    
    .hide-tablet {
        display: none !important;
    }
    
    .grid-2-mobile {
        display: grid;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }
    
    .grid-3-mobile {
        display: grid;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px;
    }
    
    .text-center-mobile {
        text-align: center;
    }
    
    .flex-column-mobile {
        flex-direction: column;
    }
    
    .flex-wrap-mobile {
        flex-wrap: wrap;
    }
    
    .w-100-mobile {
        width: 100% !important;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 13px;
    }
    
    .landing-hero h1 {
        font-size: 24px;
    }
    
    .landing-hero .btn-lg {
        padding: 14px 24px;
        font-size: 15px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    .alert {
        padding: 12px 16px;
        font-size: 13px;
    }
    
    .modal {
        width: 95%;
        margin: 10px;
        max-height: 85vh;
    }
    
    .modal-header {
        padding: 12px 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .modal-footer {
        padding: 12px 16px;
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    .table-mobile-card {
        display: block;
    }
    
    .table-mobile-card thead {
        display: none;
    }
    
    .table-mobile-card tbody,
    .table-mobile-card tr,
    .table-mobile-card td {
        display: block;
        width: 100%;
    }
    
    .table-mobile-card tr {
        margin-bottom: 12px;
        border: 1px solid var(--gray-200);
        border-radius: var(--border-radius);
        background: white;
    }
    
    .table-mobile-card td {
        padding: 10px 12px;
        border-bottom: 1px solid var(--gray-100);
        text-align: left;
    }
    
    .table-mobile-card td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--gray-600);
        display: block;
        margin-bottom: 4px;
        font-size: 11px;
        text-transform: uppercase;
    }
    
    .table-mobile-card td:last-child {
        border-bottom: none;
    }
    
    .flex-column-mobile {
        flex-direction: column;
    }
    
    .flex-wrap-mobile {
        flex-wrap: wrap;
    }
    
    .p-1-mobile { padding: 8px; }
    .p-2-mobile { padding: 16px; }
    .p-3-mobile { padding: 24px; }
    
    .m-1-mobile { margin: 8px; }
    .m-2-mobile { margin: 16px; }
    
    .grid-2-mobile,
    .grid-3-mobile {
        grid-template-columns: 1fr !important;
    }
    
    .hide-480 {
        display: none !important;
    }
}

@media (hover: none) and (pointer: coarse) {
    .btn,
    .nav-link,
    a,
    input,
    select,
    textarea {
        min-height: 44px;
    }
    
    .btn {
        touch-action: manipulation;
    }
    
    a,
    .nav-link {
        padding: 12px 16px;
    }
    
    .table th,
    .table td {
        padding: 14px 12px;
    }
    
    .form-control {
        padding: 14px 12px;
    }
    
    input[type="checkbox"],
    input[type="radio"] {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 320px) {
    body {
        font-size: 12px;
    }
    
    .landing-hero h1 {
        font-size: 20px;
    }
    
    .landing-hero p {
        font-size: 13px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    body {
        -webkit-font-smoothing: antialiased;
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    .landing-hero {
        padding: 40px 20px;
    }
    
    .landing-hero h1 {
        font-size: 24px;
        margin-bottom: 8px;
    }
    
    .landing-hero p {
        font-size: 14px;
        margin-bottom: 20px;
    }
}
