* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f5f5;
    min-height: 100vh;
}

/* ============================================
   STYLE APPLICATION MOBILE
   ============================================ */

/* Conteneur principal style app */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: #f8f9fa;
}

/* Header style app */
.app-header {
    background: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e9ecef;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.driver-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 20px;
}

.driver-info h2 {
    font-size: 16px;
    margin: 0 0 4px 0;
    color: #333;
}

.driver-status {
    font-size: 12px;
    color: #28a745;
}

/* Main content */
.app-main {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* Page content */
.page-content {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Stats cards */
.stats-cards {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    flex: 1;
    background: white;
    padding: 16px;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.stat-value {
    font-size: 28px;
    font-weight: bold;
    color: #007bff;
    display: block;
}

.stat-label {
    font-size: 12px;
    color: #666;
    margin-top: 4px;
}

/* Section title */
.section-title {
    margin-bottom: 16px;
}

.section-title h3 {
    font-size: 18px;
    color: #333;
    margin: 0;
}

/* Delivery cards */
.delivery-card {
    background: white;
    border-radius: 16px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.delivery-card-header {
    padding: 12px 16px;
    background: #f8f9fa;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #e9ecef;
}

.delivery-order {
    font-weight: bold;
    color: #007bff;
}

.delivery-status {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.status-pending {
    background: #fff3e0;
    color: #ff9800;
}

.status-progress {
    background: #e3f2fd;
    color: #2196f3;
}

.delivery-card-body {
    padding: 12px 16px;
}

.delivery-card-body .icon {
    width: 24px;
    display: inline-block;
}

.delivery-client, .delivery-address, .delivery-time, .delivery-amount {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 14px;
    color: #555;
}

.delivery-address {
    color: #333;
    font-weight: 500;
}

.btn-start-delivery {
    width: calc(100% - 32px);
    margin: 0 16px 16px 16px;
    padding: 12px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-start-delivery:hover {
    background: #218838;
}

/* Active deliveries section */
.active-deliveries-section h4 {
    font-size: 16px;
    color: #374151;
    margin-bottom: 12px;
}

.delivery-card.active-card {
    border-left: 4px solid #10b981;
}

.btn-complete {
    width: calc(100% - 32px);
    margin: 0 16px 16px 16px;
    padding: 10px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-complete:hover {
    background: #059669;
}

/* Bottom Navigation */
.bottom-nav {
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 8px 16px 12px;
    border-top: 1px solid #e9ecef;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.nav-icon {
    font-size: 24px;
    margin-bottom: 4px;
    opacity: 0.6;
}

.nav-label {
    font-size: 11px;
    color: #666;
    opacity: 0.6;
}

.nav-item.active .nav-icon,
.nav-item.active .nav-label {
    opacity: 1;
    color: #007bff;
}

.nav-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: #dc3545;
    color: white;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
}

/* ============================================
   STYLE MODAL COMMANDE (STYLE UBER)
   ============================================ */

.order-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.order-modal-content {
    background: white;
    border-radius: 28px;
    width: 90%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.order-modal-header {
    padding: 20px 20px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #f0f0f0;
    position: relative;
}

.pulse-animation {
    position: relative;
    width: 12px;
    height: 12px;
}

.pulse-dot {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(2.5);
        opacity: 0;
    }
}

.new-order-badge {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.close-modal {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #999;
    width: auto;
    padding: 0;
}

.close-modal:hover {
    color: #333;
}

.order-modal-body {
    padding: 20px;
}

.order-location {
    margin-bottom: 24px;
}

.pickup-location, .delivery-location {
    display: flex;
    gap: 16px;
    position: relative;
}

.pickup-location {
    margin-bottom: 24px;
}

.location-marker {
    position: relative;
    width: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.location-marker.pickup .marker-dot {
    width: 14px;
    height: 14px;
    background: #10b981;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 2px #10b981;
}

.location-marker.delivery .marker-dot {
    width: 14px;
    height: 14px;
    background: #ef4444;
    border: 2px solid white;
    border-radius: 50%;
    box-shadow: 0 0 0 2px #ef4444;
}

.marker-line {
    width: 2px;
    height: 40px;
    background: #e5e7eb;
    margin: 4px 0;
}

.location-info {
    flex: 1;
}

.location-label {
    font-size: 12px;
    color: #6b7280;
    display: block;
    margin-bottom: 4px;
}

.location-address {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
    display: block;
    margin-bottom: 4px;
}

.location-distance {
    font-size: 12px;
    color: #6b7280;
}

.order-details {
    background: #f9fafb;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 24px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #e5e7eb;
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-icon {
    font-size: 18px;
    width: 28px;
}

.detail-text {
    font-size: 14px;
    color: #374151;
}

.detail-text.price {
    font-weight: 700;
    color: #10b981;
    font-size: 18px;
}

.order-timer {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.timer-circle {
    position: relative;
    width: 100px;
    height: 100px;
}

.timer-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.timer-bg {
    fill: none;
    stroke: #e5e7eb;
    stroke-width: 8;
}

.timer-progress {
    fill: none;
    stroke: #10b981;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear, stroke 0.3s;
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
}

.order-modal-footer {
    display: flex;
    gap: 12px;
    padding: 0 20px 20px 20px;
}

.btn-refuse, .btn-accept {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    border: none;
    border-radius: 40px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-refuse {
    background: #f3f4f6;
    color: #6b7280;
}

.btn-refuse:hover {
    background: #e5e7eb;
}

.btn-accept {
    background: #10b981;
    color: white;
}

.btn-accept:hover {
    background: #059669;
    transform: scale(1.02);
}

.btn-icon {
    font-size: 18px;
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    border-radius: 40px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    z-index: 2100;
    transition: transform 0.3s ease;
    white-space: nowrap;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast-success {
    background: #10b981;
}

.toast-error {
    background: #ef4444;
}

.toast-warning {
    background: #f59e0b;
}

.toast-info {
    background: #3b82f6;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

body.modal-open {
    overflow: hidden;
}

/* Profile Page */
.profile-page {
    text-align: center;
}

.profile-header {
    margin-bottom: 24px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: white;
    font-size: 32px;
    font-weight: bold;
}

.profile-stats {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.profile-stat {
    flex: 1;
    background: white;
    padding: 16px;
    border-radius: 16px;
}

.stat-number {
    font-size: 24px;
    font-weight: bold;
    color: #007bff;
    display: block;
}

.profile-info {
    background: white;
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 24px;
    text-align: left;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
}

.info-item:last-child {
    border-bottom: none;
}

.info-label {
    color: #666;
}

.info-value {
    font-weight: 500;
    color: #333;
}

.btn-logout-full {
    width: 100%;
    padding: 14px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-logout-full:hover {
    background: #c82333;
}

/* Map Page */
.map-container {
    margin: -16px;
}

.position-info {
    position: fixed;
    bottom: 80px;
    left: 16px;
    right: 16px;
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    text-align: center;
    z-index: 1000;
}

/* History Cards */
.history-card {
    background: white;
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 8px;
}

.history-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.history-order {
    font-weight: bold;
    color: #007bff;
}

.history-date {
    font-size: 11px;
    color: #999;
}

.history-client {
    font-weight: 500;
    margin-bottom: 4px;
}

.history-address {
    font-size: 13px;
    color: #666;
    margin-bottom: 8px;
}

.history-amount {
    font-weight: bold;
    color: #28a745;
}

/* Loading Screen */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e9ecef;
    border-top-color: #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-state {
    text-align: center;
    padding: 48px;
    color: #666;
    font-size: 14px;
}

/* ============================================
   STYLE CONNEXION (gardé pour index.php)
   ============================================ */

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

/* Page de connexion */
.logo {
    text-align: center;
    margin: 40px 0 30px;
}

.logo h1 {
    color: #333;
    font-size: 24px;
}

.logo p {
    color: #666;
    margin-top: 5px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: #555;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #007bff;
}

button {
    width: 100%;
    padding: 14px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

button:hover {
    background: #0056b3;
}

button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.error {
    color: #dc3545;
    text-align: center;
    margin-top: 15px;
    padding: 10px;
    background: #ffe6e8;
    border-radius: 5px;
}

.hidden {
    display: none;
}

/* ============================================
   STYLE DASHBOARD (compatible avec app mobile)
   ============================================ */

/* Header (version dashboard classique) */
header {
    background: #333;
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-left h2 {
    font-size: 24px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-logout {
    width: auto;
    padding: 8px 16px;
    background: #dc3545;
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.3s;
}

.btn-logout:hover {
    background: #c82333;
}

/* Bouton de statut en ligne/hors ligne */
.btn-status {
    width: auto;
    padding: 8px 16px;
    border: none;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-status-online {
    background: #28a745;
    color: white;
}

.btn-status-online:hover {
    background: #218838;
}

.btn-status-offline {
    background: #dc3545;
    color: white;
}

.btn-status-offline:hover {
    background: #c82333;
}

.btn-status:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.stats {
    display: flex;
    gap: 15px;
    margin: 20px 0;
}

.stat-card {
    flex: 1;
    background: white;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-label {
    display: block;
    color: #666;
    font-size: 14px;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: bold;
    color: #007bff;
}

h3 {
    margin: 20px 0;
    color: #333;
}

.delivery-item {
    background: white;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border-left: 4px solid #007bff;
}

.delivery-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.delivery-id {
    font-weight: bold;
    color: #007bff;
}

.delivery-status {
    padding: 3px 8px;
    background: #ffc107;
    border-radius: 12px;
    font-size: 12px;
    color: #333;
}

.delivery-address {
    color: #555;
    margin-bottom: 5px;
}

.delivery-time {
    color: #888;
    font-size: 14px;
    margin-bottom: 10px;
}

.btn-start {
    width: auto;
    padding: 8px 16px;
    background: #28a745;
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-start:hover {
    background: #218838;
}

.loading {
    text-align: center;
    color: #666;
    padding: 40px;
}

/* Section carte */
.map-section {
    margin: 20px 0;
    text-align: center;
}

.btn-map {
    background: #28a745;
    margin-bottom: 15px;
    width: auto;
    padding: 10px 20px;
    display: inline-block;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-map:hover {
    background: #218838;
}

.btn-map:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.map-container {
    margin: 20px 0;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.map-container.hidden {
    display: none;
}

.map-note {
    text-align: center;
    color: #666;
    font-size: 12px;
    margin-top: 5px;
}

#map {
    height: 400px;
    width: 100%;
    border-radius: 8px 8px 0 0;
}

/* Info window personnalisée pour Google Maps */
.driver-info-window {
    padding: 10px;
    max-width: 200px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.driver-info-window h4 {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.driver-info-window p {
    margin: 4px 0;
    font-size: 12px;
    color: #666;
}

.driver-info-window strong {
    color: #333;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Pour les très petits écrans (moins de 400px) */
@media (max-width: 400px) {
    .stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .stats-cards {
        flex-direction: column;
    }
    
    .profile-stats {
        flex-direction: column;
    }
    
    .header-left h2 {
        font-size: 20px;
    }
    
    .header-right {
        gap: 5px;
    }
    
    .btn-status {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .btn-logout {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .container {
        padding: 10px;
    }
    
    .btn-map {
        width: 100%;
    }
    
    #map {
        height: 300px;
    }
    
    .nav-icon {
        font-size: 20px;
    }
    
    .nav-label {
        font-size: 10px;
    }
    
    .order-modal-content {
        width: 95%;
        border-radius: 20px;
    }
    
    .toast {
        font-size: 12px;
        padding: 10px 20px;
        white-space: normal;
        text-align: center;
        max-width: 90%;
    }
}

/* Pour les écrans de taille moyenne */
@media (min-width: 768px) {
    .app-container {
        max-width: 500px;
        margin: 0 auto;
        box-shadow: 0 0 20px rgba(0,0,0,0.1);
    }
    
    .bottom-nav {
        max-width: 500px;
        margin: 0 auto;
        left: 0;
        right: 0;
    }
    
    .position-info {
        max-width: 468px;
        margin: 0 auto;
        left: 0;
        right: 0;
    }
}