/**
 * GBE Courier Portal Styles
 * Mobile-First Design for Delivery Drivers
 */

:root {
    /* Brand Colors */
    --gbe-primary: #1e40af;
    --gbe-secondary: #fbbf24;
    --gbe-yellow: #fbbf24;
    --gbe-dark: #1f2937;
    --gbe-light: #f9fafb;

    /* Courier Portal Specific */
    --courier-gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --courier-gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --courier-gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --courier-gradient-4: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
    --courier-gradient-5: linear-gradient(135deg, #fbbf24 0%, #fb923c 100%);

    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: rgba(0, 0, 0, 0.1);

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.5rem;
    --radius-md: 1rem;
    --radius-lg: 1.5rem;
    --radius-xl: 2rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px 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);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* Dark Mode Variables */
[data-theme="dark"] {
    --gbe-light: #1f2937;
    --gbe-dark: #f9fafb;
    --glass-bg: rgba(31, 41, 55, 0.8);
    --glass-border: rgba(255, 255, 255, 0.1);
}

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

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--gbe-light);
    color: var(--gbe-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* Animated Background */
.courier-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

.courier-bg::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 20% 50%, rgba(251, 191, 36, 0.3) 0%, transparent 50%),
                radial-gradient(circle at 80% 80%, rgba(99, 102, 241, 0.3) 0%, transparent 50%);
    animation: bgPulse 10s ease-in-out infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes bgPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Glassmorphism Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    padding: var(--spacing-lg);
    transition: all 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-2xl);
}

/* Login Page Styles */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-md);
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-2xl);
    padding: var(--spacing-xl);
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.login-logo img {
    max-width: 150px;
    height: auto;
    animation: fadeIn 0.8s ease;
}

.login-welcome {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.login-welcome h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gbe-dark);
    margin-bottom: var(--spacing-xs);
}

.login-welcome p {
    color: #6b7280;
    font-size: 0.95rem;
}

.wave-hand {
    display: inline-block;
    animation: wave 2s ease-in-out infinite;
    transform-origin: 70% 70%;
}

@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    10%, 30% { transform: rotate(14deg); }
    20%, 40% { transform: rotate(-8deg); }
}

/* Form Styles */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gbe-dark);
    margin-bottom: var(--spacing-xs);
}

.form-input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: white;
}

.form-input:focus {
    outline: none;
    border-color: var(--gbe-primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
}

.form-input::placeholder {
    color: #9ca3af;
}

.form-input.error {
    border-color: #ef4444;
}

.form-input.success {
    border-color: #10b981;
}

/* Masked Email */
.masked-email {
    background: #f3f4f6;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    text-align: center;
    border: 2px dashed #d1d5db;
}

.masked-email p {
    font-size: 0.875rem;
    color: #6b7280;
    margin-bottom: var(--spacing-xs);
}

.masked-email strong {
    color: var(--gbe-primary);
    font-size: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

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

.btn-primary:hover {
    background: #1e3a8a;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-yellow {
    background: var(--gbe-yellow);
    color: var(--gbe-dark);
}

.btn-yellow:hover {
    background: #f59e0b;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-full {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-loading {
    position: relative;
    color: transparent;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Return to Homepage Button */
.btn-home {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: rgba(255, 255, 255, 0.95);
    color: #1e40af;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    text-decoration: none;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

html[dir="rtl"] .btn-home {
    left: auto;
    right: 20px;
}

.btn-home:hover {
    background: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    color: #667eea;
}

.btn-home svg {
    width: 20px;
    height: 20px;
}

.btn-home span {
    font-weight: 600;
}

@media (max-width: 768px) {
    .btn-home span {
        display: none;
    }
    .btn-home {
        padding: 0.75rem;
        width: 48px;
        height: 48px;
        justify-content: center;
    }
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: var(--spacing-md);
    right: var(--spacing-md);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.toast {
    min-width: 300px;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    animation: slideInRight 0.3s ease;
    background: white;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-left: 4px solid #10b981;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast.info {
    border-left: 4px solid #3b82f6;
}

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.toast-message {
    font-size: 0.8125rem;
    color: #6b7280;
}

/* Dashboard Styles */
.dashboard-container {
    min-height: 100vh;
    padding-bottom: 80px; /* Space for bottom nav */
}

/* Header */
.dashboard-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
    animation: slideDown 0.5s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.header-profile {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-sm);
}

.profile-photo {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-full);
    border: 3px solid var(--gbe-yellow);
    object-fit: cover;
    animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.profile-info {
    flex: 1;
}

.profile-greeting {
    font-size: 0.875rem;
    color: #6b7280;
}

.profile-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gbe-dark);
    margin-bottom: 0.25rem;
}

.profile-date {
    font-size: 0.8125rem;
    color: #9ca3af;
}

.btn-logout {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: #dc2626;
    transform: scale(1.05);
}

/* Dashboard Content */
.dashboard-content {
    padding: var(--spacing-md);
    max-width: 1200px;
    margin: 0 auto;
}

/* Financial Summary Cards */
.financial-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-lg);
}

.financial-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    animation: fadeInUp 0.5s ease;
    animation-fill-mode: both;
}

.financial-card:nth-child(1) {
    animation-delay: 0.1s;
}

.financial-card:nth-child(2) {
    animation-delay: 0.2s;
}

.financial-card:nth-child(3) {
    animation-delay: 0.3s;
}

.financial-card:nth-child(4) {
    animation-delay: 0.4s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.financial-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--card-gradient, var(--courier-gradient-1)));
}

.financial-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.financial-card.earnings {
    --card-gradient: var(--courier-gradient-5);
}

.financial-card.month {
    --card-gradient: var(--courier-gradient-3);
}

.financial-card.pending {
    --card-gradient: var(--courier-gradient-2);
}

.financial-card.last-payment {
    --card-gradient: var(--courier-gradient-4);
}

.card-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
}

.card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--card-gradient, var(--courier-gradient-1)));
    color: white;
    font-size: 1.5rem;
}

.card-title {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gbe-dark);
    margin-bottom: var(--spacing-xs);
    font-family: 'Plus Jakarta Sans', monospace;
}

.card-subtitle {
    font-size: 0.8125rem;
    color: #9ca3af;
}

.card-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius-sm);
    margin-top: var(--spacing-xs);
}

.card-trend.up {
    background: #d1fae5;
    color: #059669;
}

.card-trend.down {
    background: #fee2e2;
    color: #dc2626;
}

/* Info Section */
.info-section {
    background: white;
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--spacing-lg);
    animation: fadeInUp 0.5s ease 0.5s both;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gbe-dark);
    margin-bottom: var(--spacing-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.section-title::before {
    content: '';
    width: 4px;
    height: 24px;
    background: var(--gbe-yellow);
    border-radius: var(--radius-sm);
}

.info-grid {
    display: grid;
    gap: var(--spacing-md);
}

.info-item {
    display: flex;
    align-items: start;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}

.info-item:hover {
    background: #f9fafb;
}

.info-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--courier-gradient-1));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.info-content {
    flex: 1;
}

.info-label {
    font-size: 0.8125rem;
    color: #6b7280;
    margin-bottom: 0.25rem;
}

.info-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--gbe-dark);
}

/* Status Badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
}

.status-badge.active {
    background: #d1fae5;
    color: #059669;
}

.status-badge.inactive {
    background: #fee2e2;
    color: #dc2626;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Documents Section */
.documents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--spacing-md);
}

.document-item {
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    background: #f3f4f6;
    box-shadow: var(--shadow-sm);
}

.document-item:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

.document-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.document-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: #9ca3af;
}

.document-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
    color: white;
    padding: var(--spacing-sm);
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.document-item:hover .document-overlay {
    opacity: 1;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    padding: var(--spacing-sm) var(--spacing-md);
    z-index: 100;
}

.nav-items {
    display: flex;
    justify-content: space-around;
    align-items: center;
    max-width: 600px;
    margin: 0 auto;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: var(--spacing-xs);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    color: #6b7280;
}

.nav-item:hover,
.nav-item.active {
    color: var(--gbe-primary);
    background: rgba(30, 64, 175, 0.1);
}

.nav-icon {
    font-size: 1.5rem;
}

.nav-label {
    font-size: 0.75rem;
    font-weight: 600;
}

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-card {
    height: 150px;
}

/* Pull to Refresh */
.pull-to-refresh {
    position: absolute;
    top: -60px;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gbe-primary);
    font-size: 0.875rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.pull-to-refresh.active {
    top: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .financial-cards {
        grid-template-columns: 1fr;
    }

    .login-card {
        padding: var(--spacing-lg);
    }

    .toast-container {
        left: var(--spacing-md);
        right: var(--spacing-md);
    }

    .toast {
        min-width: auto;
    }
}

@media (min-width: 768px) {
    .bottom-nav {
        display: none;
    }

    .dashboard-container {
        padding-bottom: 0;
    }
}

/* Animations for icons */
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.bounce {
    animation: bounce 2s ease-in-out infinite;
}

/* Counter Animation */
@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.count-up {
    animation: countUp 0.5s ease;
}

/* Floating Action Button */
.fab {
    position: fixed;
    bottom: 100px;
    right: var(--spacing-md);
    width: 56px;
    height: 56px;
    border-radius: var(--radius-full);
    background: var(--gbe-yellow);
    color: var(--gbe-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-xl);
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    font-size: 1.5rem;
    z-index: 99;
}

.fab:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: var(--shadow-2xl);
}

@media (min-width: 768px) {
    .fab {
        bottom: var(--spacing-md);
    }
}
