/**
 * Delivery Agent System Styles
 * 
 * Comprehensive styling for all agent-related components including:
 * - Agent registration form
 * - Agent dashboard layout
 * - Delivery cards and status badges
 * - Order tracking page
 * - Mobile responsive design
 * - Loading states and animations
 */

/* ==========================================================================
   Agent Registration Form
   ========================================================================== */

.rwm-agent-registration {
    max-width: 600px;
    margin: 0 auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.rwm-agent-registration h2 {
    text-align: center;
    color: #2c3e50;
    margin-bottom: 30px;
    font-size: 28px;
    font-weight: 600;
}

.rwm-agent-registration .form-group {
    margin-bottom: 20px;
}

.rwm-agent-registration label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #34495e;
    font-size: 14px;
}

.rwm-agent-registration input[type="text"],
.rwm-agent-registration input[type="email"],
.rwm-agent-registration input[type="tel"],
.rwm-agent-registration select,
.rwm-agent-registration textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background-color: #ffffff;
}

.rwm-agent-registration input:focus,
.rwm-agent-registration select:focus,
.rwm-agent-registration textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.rwm-agent-registration .submit-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 20px;
}

.rwm-agent-registration .submit-btn:hover {
    background: linear-gradient(135deg, #2980b9, #21618c);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.3);
}

.rwm-agent-registration .submit-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.rwm-agent-registration .error-message {
    color: #e74c3c;
    font-size: 14px;
    margin-top: 5px;
    display: block;
}

.rwm-agent-registration .success-message {
    background: #d4edda;
    color: #155724;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #c3e6cb;
}

/* ==========================================================================
   Agent Dashboard Layout
   ========================================================================== */

.rwm-agent-dashboard {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.rwm-agent-dashboard .dashboard-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    text-align: center;
}

.rwm-agent-dashboard .dashboard-header h1 {
    margin: 0 0 10px 0;
    font-size: 32px;
    font-weight: 700;
}

.rwm-agent-dashboard .dashboard-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 16px;
}

.rwm-agent-dashboard .logout-link {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    transition: all 0.3s ease;
}

.rwm-agent-dashboard .logout-link:hover {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* Statistics Cards */
.rwm-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.rwm-stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    text-align: center;
    transition: all 0.3s ease;
}

.rwm-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.rwm-stat-card .stat-icon {
    font-size: 48px;
    margin-bottom: 15px;
    color: #3498db;
}

.rwm-stat-card .stat-value {
    font-size: 36px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 5px;
}

.rwm-stat-card .stat-label {
    color: #7f8c8d;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ==========================================================================
   Delivery Cards and Status Badges
   ========================================================================== */

.rwm-deliveries-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
}

.rwm-deliveries-section h3 {
    margin: 0 0 25px 0;
    color: #2c3e50;
    font-size: 24px;
    font-weight: 600;
}

.rwm-delivery-card {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    position: relative;
}

.rwm-delivery-card:hover {
    border-color: #3498db;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.1);
}

.rwm-delivery-card.active {
    border-color: #27ae60;
    background: #f8fff9;
}

.rwm-delivery-card .order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.rwm-delivery-card .order-number {
    font-size: 18px;
    font-weight: 700;
    color: #2c3e50;
}

.rwm-delivery-card .order-time {
    color: #7f8c8d;
    font-size: 14px;
}

.rwm-delivery-card .customer-info {
    margin-bottom: 15px;
    padding: 15px;
    background: white;
    border-radius: 8px;
}

.rwm-delivery-card .customer-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.rwm-delivery-card .customer-address {
    color: #7f8c8d;
    font-size: 14px;
    line-height: 1.4;
}

.rwm-delivery-card .order-total {
    font-size: 20px;
    font-weight: 700;
    color: #27ae60;
    text-align: right;
    margin-bottom: 15px;
}

/* Status Badges */
.rwm-status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.rwm-status-badge.pending {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.rwm-status-badge.claimed {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.rwm-status-badge.picked-up {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.rwm-status-badge.out-for-delivery {
    background: #cce5ff;
    color: #004085;
    border: 1px solid #99d6ff;
}

.rwm-status-badge.delivered {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.rwm-status-badge.cancelled {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Action Buttons */
.rwm-delivery-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.rwm-action-btn {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.rwm-action-btn.primary {
    background: #3498db;
    color: white;
}

.rwm-action-btn.primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
}

.rwm-action-btn.success {
    background: #27ae60;
    color: white;
}

.rwm-action-btn.success:hover {
    background: #229954;
    transform: translateY(-2px);
}

.rwm-action-btn.warning {
    background: #f39c12;
    color: white;
}

.rwm-action-btn.warning:hover {
    background: #e67e22;
    transform: translateY(-2px);
}

.rwm-action-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================================================
   Order Tracking Page
   ========================================================================== */

.rwm-order-tracking {
    max-width: 100%;
    margin: 0;
    padding: 30px;
}

/* Ensure confirmation/tracking view can be full width when requested */
.rwm-order-tracking.rwm-confirmation-fullwidth {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 30px;
    box-sizing: border-box;
}

.rwm-tracking-header {
    text-align: center;
    margin-bottom: 40px;
}

.rwm-tracking-header h1 {
    color: #2c3e50;
    margin-bottom: 10px;
}

.rwm-tracking-header .order-number {
    color: #7f8c8d;
    font-size: 18px;
}

/* Progress Indicator */
.rwm-progress-indicator {
    margin-bottom: 40px;
}

.rwm-progress-steps {
    display: flex;
    justify-content: space-between;
    position: relative;
    margin-bottom: 20px;
}

.rwm-progress-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 0;
    right: 0;
    height: 4px;
    background: #e9ecef;
    z-index: 1;
}

.rwm-progress-line {
    position: absolute;
    top: 20px;
    left: 0;
    height: 4px;
    background: linear-gradient(90deg, #27ae60, #2ecc71);
    z-index: 2;
    transition: width 0.5s ease;
}

.rwm-progress-step {
    position: relative;
    z-index: 3;
    text-align: center;
    flex: 1;
}

.rwm-progress-step .step-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e9ecef;
    border: 4px solid #e9ecef;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.rwm-progress-step.active .step-circle {
    background: #27ae60;
    border-color: #27ae60;
    color: white;
}

.rwm-progress-step.completed .step-circle {
    background: #27ae60;
    border-color: #27ae60;
    color: white;
}

.rwm-progress-step .step-label {
    font-size: 12px;
    color: #7f8c8d;
    font-weight: 600;
    text-transform: uppercase;
}

.rwm-progress-step.active .step-label,
.rwm-progress-step.completed .step-label {
    color: #27ae60;
}

/* Delivery Info */
.rwm-delivery-info {
    background: white;
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
}

.rwm-delivery-info h3 {
    margin: 0 0 20px 0;
    color: #2c3e50;
}

.rwm-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.rwm-info-item {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.rwm-info-item .label {
    font-size: 12px;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.rwm-info-item .value {
    font-size: 16px;
    color: #2c3e50;
    font-weight: 600;
}

/* Confirmation Button */
.rwm-confirm-delivery {
    text-align: center;
    margin-top: 30px;
}

.rwm-confirm-btn {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 50px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.rwm-confirm-btn:hover {
    background: linear-gradient(135deg, #229954, #27ae60);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.3);
}

/* ==========================================================================
   Notification Toggle
   ========================================================================== */

.rwm-notification-toggle {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
}

.rwm-notification-toggle h3 {
    margin: 0 0 15px 0;
    color: #2c3e50;
}

.rwm-toggle-switch {
    position: relative;
    display: inline-block;
    width: 60px;
    height: 34px;
}

.rwm-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.rwm-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 34px;
}

.rwm-toggle-slider:before {
    position: absolute;
    content: "";
    height: 26px;
    width: 26px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .rwm-toggle-slider {
    background-color: #27ae60;
}

input:checked + .rwm-toggle-slider:before {
    transform: translateX(26px);
}

/* ==========================================================================
   Loading States and Animations
   ========================================================================== */

.rwm-loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(52, 152, 219, 0.3);
    border-radius: 50%;
    border-top-color: #3498db;
    animation: rwm-spin 1s ease-in-out infinite;
}

@keyframes rwm-spin {
    to { transform: rotate(360deg); }
}

.rwm-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.rwm-loading-overlay .rwm-loading {
    width: 50px;
    height: 50px;
    border-width: 5px;
}

/* Fade in animation */
.rwm-fade-in {
    animation: rwm-fadeIn 0.5s ease-in;
}

@keyframes rwm-fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Mobile Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .rwm-agent-dashboard {
        padding: 15px;
    }
    
    .rwm-agent-dashboard .dashboard-header {
        padding: 20px;
        position: relative;
    }
    
    .rwm-agent-dashboard .logout-link {
        position: static;
        display: block;
        margin-top: 15px;
        text-align: center;
    }
    
    .rwm-stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .rwm-delivery-card .order-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .rwm-delivery-actions {
        flex-direction: column;
    }
    
    .rwm-progress-steps {
        flex-direction: column;
        gap: 20px;
    }
    
    .rwm-progress-steps::before {
        display: none;
    }
    
    .rwm-info-grid {
        grid-template-columns: 1fr;
    }
    
    .rwm-agent-registration {
        margin: 15px;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .rwm-agent-dashboard .dashboard-header h1 {
        font-size: 24px;
    }
    
    .rwm-stat-card {
        padding: 20px;
    }
    
    .rwm-stat-card .stat-value {
        font-size: 28px;
    }
    
    .rwm-delivery-card {
        padding: 15px;
    }
    
    .rwm-order-tracking {
        padding: 15px;
    }
    
    .rwm-delivery-info {
        padding: 20px;
    }
}

/* ==========================================================================
   Application Cards in Owner Dashboard
   ========================================================================== */

.rwm-application-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.rwm-application-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.rwm-application-card .applicant-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.rwm-application-card .applicant-name {
    font-size: 20px;
    font-weight: 700;
    color: #2c3e50;
}

.rwm-application-card .application-date {
    color: #7f8c8d;
    font-size: 14px;
}

.rwm-application-card .applicant-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.rwm-application-card .detail-item {
    display: flex;
    flex-direction: column;
}

.rwm-application-card .detail-label {
    font-size: 12px;
    color: #7f8c8d;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
}

.rwm-application-card .detail-value {
    color: #2c3e50;
    font-weight: 600;
}

.rwm-application-card .application-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.rwm-application-card .approve-btn {
    background: #27ae60;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.rwm-application-card .approve-btn:hover {
    background: #229954;
    transform: translateY(-2px);
}

.rwm-application-card .reject-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.rwm-application-card .reject-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.rwm-text-center { text-align: center; }
.rwm-text-left { text-align: left; }
.rwm-text-right { text-align: right; }

.rwm-mb-10 { margin-bottom: 10px; }
.rwm-mb-15 { margin-bottom: 15px; }
.rwm-mb-20 { margin-bottom: 20px; }
.rwm-mb-30 { margin-bottom: 30px; }

.rwm-mt-10 { margin-top: 10px; }
.rwm-mt-15 { margin-top: 15px; }
.rwm-mt-20 { margin-top: 20px; }
.rwm-mt-30 { margin-top: 30px; }

.rwm-hidden { display: none; }
.rwm-visible { display: block; }

.rwm-text-success { color: #27ae60; }
.rwm-text-error { color: #e74c3c; }
.rwm-text-warning { color: #f39c12; }
.rwm-text-info { color: #3498db; }

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .rwm-agent-dashboard .logout-link,
    .rwm-delivery-actions,
    .rwm-notification-toggle {
        display: none;
    }
    
    .rwm-delivery-card {
        break-inside: avoid;
        margin-bottom: 20px;
    }
    
    .rwm-agent-dashboard .dashboard-header {
        background: none;
        color: #2c3e50;
    }
}