/**
 * Rider Dashboard Custom Styles
 * Custom styling for the rider delivery management dashboard
 */

/* ========================================
   1. GLOBAL STYLES
   ======================================== */

:root {
    --primary: #4e0543;
    --secondary: #730873;
    --accent: #5e055e;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --light: #f8f9fa;
    --dark: #343a40;
    --cream: #eee0c6;
    --gray-light: #edeef0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f5f5;
    padding-bottom: 80px;
    overflow-x: hidden;
}

.main-content {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* ========================================
   2. APP HEADER
   ======================================== */

.app-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.app-header h1 {
    font-size: 1.25rem;
    margin: 0;
    font-weight: 600;
}

.app-header small {
    font-size: 0.875rem;
    opacity: 0.9;
}

/* ========================================
   3. STATS CARDS
   ======================================== */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: white;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    text-align: center;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.stat-card .stat-icon {
    font-size: 2rem;
    color: var(--secondary);
    margin-bottom: 0.5rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0.5rem 0;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   4. STATUS TOGGLE
   ======================================== */

.status-toggle-container {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.status-toggle-label {
    font-weight: 600;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 34px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--success);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(26px);
}

/* ========================================
   5. ORDER CARDS
   ======================================== */

.orders-section {
    margin-bottom: 2rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dark);
}

.order-card {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border-left: 4px solid var(--secondary);
}

.order-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #eee;
}

.order-number {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--secondary);
    margin: 0;
}

.order-time {
    font-size: 0.875rem;
    color: #6c757d;
}

.order-body {
    margin-bottom: 1rem;
}

.order-info {
    margin-bottom: 1rem;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: #495057;
    font-size: 0.9rem;
}

.info-item i {
    color: var(--secondary);
    min-width: 20px;
}

.order-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 0.75rem;
    background: var(--gray-light);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.order-amount,
.order-earning {
    text-align: center;
}

.order-amount small,
.order-earning small {
    display: block;
    font-size: 0.75rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.order-amount strong,
.order-earning strong {
    font-size: 1.125rem;
    color: var(--dark);
}

.order-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.order-actions .btn {
    font-size: 0.875rem;
    padding: 0.625rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.order-actions .btn:hover {
    transform: translateY(-1px);
}

/* ========================================
   6. BOTTOM NAVIGATION
   ======================================== */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    z-index: 1000;
}

.nav-item {
    flex: 1;
    text-align: center;
    color: #999;
    text-decoration: none;
    padding: 0.5rem;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.nav-item i {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
    transition: transform 0.3s;
}

.nav-item span {
    font-size: 0.75rem;
}

.nav-item:hover,
.nav-item.active {
    color: var(--secondary);
}

.nav-item.active i {
    transform: scale(1.1);
}

/* ========================================
   7. MAP CONTAINER
   ======================================== */

.map-container {
    position: relative;
    width: 100%;
    height: calc(100vh - 250px);
    min-height: 400px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}

#trackingMap {
    width: 100%;
    height: 100%;
}

.map-control-btn {
    background: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    margin: 0.5rem;
    transition: all 0.3s;
}

.map-control-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.map-control-btn i {
    font-size: 1.25rem;
    color: var(--secondary);
}

/* ========================================
   8. FLOATING CARD
   ======================================== */

.floating-card {
    position: fixed;
    bottom: 80px;
    left: 1rem;
    right: 1rem;
    background: white;
    border-radius: 16px;
    padding: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    z-index: 999;
    max-width: 500px;
    margin: 0 auto;
}

.floating-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.floating-card-body {
    margin-bottom: 0.75rem;
}

/* ========================================
   9. ORDER DETAILS MODAL
   ======================================== */

.order-details-modal {
    text-align: left;
}

.detail-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #eee;
}

.detail-section:last-child {
    border-bottom: none;
}

.detail-section h6 {
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.order-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.75rem;
    align-items: start;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.order-item:last-child {
    border-bottom: none;
}

.item-quantity {
    font-weight: 700;
    color: var(--secondary);
    min-width: 30px;
}

.item-details {
    flex: 1;
}

.item-name {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.25rem;
}

.item-addons {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
}

.item-instructions {
    font-size: 0.875rem;
    color: #6c757d;
    margin-top: 0.25rem;
    font-style: italic;
}

.item-price {
    font-weight: 600;
    color: var(--dark);
}

.payment-info {
    background: var(--gray-light);
    padding: 1rem;
    border-radius: 8px;
}

.payment-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
}

.payment-row.total {
    border-top: 2px solid var(--secondary);
    margin-top: 0.5rem;
    padding-top: 0.75rem;
}

.payment-row.earning {
    background: #d4edda;
    margin: 0.5rem -1rem -1rem -1rem;
    padding: 0.75rem 1rem;
    border-radius: 0 0 8px 8px;
}

/* ========================================
   10. PROFILE PAGE
   ======================================== */

.profile-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 2rem 1rem;
    text-align: center;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 4px solid white;
    margin-bottom: 1rem;
    object-fit: cover;
}

.profile-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.profile-info {
    font-size: 0.9rem;
    opacity: 0.9;
}

.profile-section {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.profile-section h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--secondary);
    margin-bottom: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(115, 8, 115, 0.1);
}

/* ========================================
   11. HISTORY PAGE
   ======================================== */

.history-filters {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.filter-tabs {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.filter-tab {
    padding: 0.5rem 1rem;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--dark);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.3s;
}

.filter-tab:hover,
.filter-tab.active {
    background: var(--secondary);
    color: white;
    border-color: var(--secondary);
}

.delivery-card {
    background: white;
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.delivery-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #eee;
}

.delivery-body p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: #495057;
}

.delivery-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #eee;
}

/* ========================================
   12. UTILITIES
   ======================================== */

.text-success {
    color: var(--success) !important;
}

.text-danger {
    color: var(--danger) !important;
}

.text-warning {
    color: var(--warning) !important;
}

.text-muted {
    color: #6c757d !important;
}

.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
    color: #fff;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: 0.375rem;
}

.badge.bg-success {
    background-color: var(--success);
}

.badge.bg-danger {
    background-color: var(--danger);
}

.badge.bg-warning {
    background-color: var(--warning);
    color: #000;
}

.badge.bg-info {
    background-color: var(--info);
}

.badge.bg-secondary {
    background-color: #6c757d;
}

.badge.bg-primary {
    background-color: var(--secondary);
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--secondary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.rotating {
    animation: spin 1s linear;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

/* ========================================
   13. RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .order-actions {
        grid-template-columns: 1fr;
    }
    
    .floating-card {
        left: 0.5rem;
        right: 0.5rem;
    }
}

@media (min-width: 768px) {
    .main-content {
        padding: 2rem;
    }
    
    .app-header {
        padding: 1.5rem;
    }
    
    .bottom-nav {
        display: none;
    }
    
    body {
        padding-bottom: 0;
    }
}

/* ========================================
   14. ANIMATIONS
   ======================================== */

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

/* ========================================
   15. PRINT STYLES
   ======================================== */

@media print {
    .app-header,
    .bottom-nav,
    .order-actions,
    .floating-card {
        display: none !important;
    }
    
    .main-content {
        padding: 0;
    }
    
    .order-card {
        page-break-inside: avoid;
    }
}
