/* ============================================
   Drivers System - Professional Styles
   Author: Solfect
   ============================================ */

:root {
    --ds-primary: #2563eb;
    --ds-primary-dark: #1d4ed8;
    --ds-primary-light: #dbeafe;
    --ds-secondary: #0f172a;
    --ds-success: #10b981;
    --ds-success-light: #d1fae5;
    --ds-warning: #f59e0b;
    --ds-warning-light: #fef3c7;
    --ds-danger: #ef4444;
    --ds-danger-light: #fee2e2;
    --ds-gray-50: #f8fafc;
    --ds-gray-100: #f1f5f9;
    --ds-gray-200: #e2e8f0;
    --ds-gray-300: #cbd5e1;
    --ds-gray-400: #94a3b8;
    --ds-gray-500: #64748b;
    --ds-gray-600: #475569;
    --ds-gray-700: #334155;
    --ds-gray-800: #1e293b;
    --ds-gray-900: #0f172a;
    --ds-radius: 12px;
    --ds-radius-sm: 8px;
    --ds-radius-lg: 16px;
    --ds-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --ds-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
    --ds-shadow-md: 0 10px 25px rgba(15, 23, 42, 0.1);
    --ds-shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.12);
    --ds-transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --ds-font: 'Cairo', 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ============================================
   Global RTL & Font
   ============================================ */
.drivers-registration,
.drivers-page,
.drivers-results,
.driver-details {
    font-family: var(--ds-font);
    direction: rtl;
    text-align: right;
    color: var(--ds-gray-800);
    line-height: 1.7;
    box-sizing: border-box;
}

.drivers-registration *,
.drivers-page *,
.drivers-results *,
.driver-details * {
    box-sizing: border-box;
}

/* ============================================
   Form Container
   ============================================ */
.drivers-registration {
    max-width: 640px;
    margin: 40px auto;
    background: #ffffff;
    border-radius: var(--ds-radius-lg);
    padding: 40px;
    box-shadow: var(--ds-shadow-md);
    border: 1px solid var(--ds-gray-100);
    position: relative;
    overflow: hidden;
}

.drivers-registration::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--ds-primary) 0%, #7c3aed 50%, #ec4899 100%);
}

.drivers-registration h2 {
    font-size: 26px;
    font-weight: 700;
    color: var(--ds-secondary);
    margin: 0 0 8px;
    text-align: center;
    padding-bottom: 20px;
    position: relative;
}

.drivers-registration h2::after {
    content: '';
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--ds-primary), #7c3aed);
    border-radius: 3px;
}

/* ============================================
   Success Message
   ============================================ */
.driver-registration-success {
    background: var(--ds-success-light);
    color: #065f46;
    border: 1px solid #6ee7b7;
    border-right: 4px solid var(--ds-success);
    padding: 16px 20px;
    border-radius: var(--ds-radius-sm);
    margin-bottom: 24px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: dsSlideDown 0.4s ease;
}

.driver-registration-success::before {
    content: '✓';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--ds-success);
    color: #fff;
    border-radius: 50%;
    font-weight: bold;
    flex-shrink: 0;
}

@keyframes dsSlideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   Form Fields
   ============================================ */
.drivers-registration form p {
    margin: 0 0 18px;
    display: flex;
    flex-direction: column;
}

.drivers-registration label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--ds-gray-700);
    margin-bottom: 8px;
}

.drivers-registration label::before {
    content: '*';
    color: var(--ds-danger);
    margin-left: 4px;
    font-weight: 700;
}

.drivers-registration input[type="text"],
.drivers-registration input[type="email"],
.drivers-registration input[type="tel"],
.drivers-registration input[type="number"],
.drivers-registration select {
    width: 100%;
    padding: 13px 16px;
    font-size: 15px;
    font-family: inherit;
    color: var(--ds-gray-800);
    background: var(--ds-gray-50);
    border: 2px solid var(--ds-gray-200);
    border-radius: var(--ds-radius-sm);
    transition: var(--ds-transition);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.drivers-registration select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 16px center;
    padding-left: 44px;
    cursor: pointer;
}

.drivers-registration input:focus,
.drivers-registration select:focus {
    border-color: var(--ds-primary);
    background-color: #fff;
    box-shadow: 0 0 0 4px var(--ds-primary-light);
}

.drivers-registration input:hover:not(:focus),
.drivers-registration select:hover:not(:focus) {
    border-color: var(--ds-gray-300);
}

.drivers-registration select:disabled {
    background-color: var(--ds-gray-100);
    color: var(--ds-gray-400);
    cursor: not-allowed;
    opacity: 0.7;
}

/* ============================================
   File Inputs
   ============================================ */
.drivers-registration input[type="file"] {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    font-family: inherit;
    background: var(--ds-gray-50);
    border: 2px dashed var(--ds-gray-300);
    border-radius: var(--ds-radius-sm);
    cursor: pointer;
    transition: var(--ds-transition);
    color: var(--ds-gray-600);
}

.drivers-registration input[type="file"]:hover {
    border-color: var(--ds-primary);
    background: var(--ds-primary-light);
}

.drivers-registration input[type="file"]:focus {
    outline: none;
    border-color: var(--ds-primary);
    box-shadow: 0 0 0 4px var(--ds-primary-light);
}

.drivers-registration input[type="file"]::file-selector-button {
    background: var(--ds-primary);
    color: #fff;
    border: none;
    padding: 8px 18px;
    border-radius: 6px;
    font-family: inherit;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    margin-left: 12px;
    transition: var(--ds-transition);
}

.drivers-registration input[type="file"]::file-selector-button:hover {
    background: var(--ds-primary-dark);
}

/* ============================================
   Submit Button
   ============================================ */
.drivers-registration button[type="submit"] {
    width: 100%;
    padding: 15px 24px;
    font-size: 16px;
    font-weight: 700;
    font-family: inherit;
    color: #fff;
    background: linear-gradient(135deg, var(--ds-primary) 0%, #7c3aed 100%);
    border: none;
    border-radius: var(--ds-radius-sm);
    cursor: pointer;
    transition: var(--ds-transition);
    margin-top: 10px;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

.drivers-registration button[type="submit"]::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.25), transparent);
    transition: left 0.5s;
}

.drivers-registration button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.45);
}

.drivers-registration button[type="submit"]:hover::after {
    left: 100%;
}

.drivers-registration button[type="submit"]:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

/* ============================================
   Drivers Listing Page
   ============================================ */
.drivers-page {
    max-width: 900px;
    margin: 40px auto;
    background: #fff;
    border-radius: var(--ds-radius-lg);
    padding: 40px;
    box-shadow: var(--ds-shadow-md);
    border: 1px solid var(--ds-gray-100);
}

.drivers-page h2 {
    font-size: 26px;
    font-weight: 700;
    color: var(--ds-secondary);
    text-align: center;
    margin: 0 0 32px;
    position: relative;
    padding-bottom: 18px;
}

.drivers-page h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, var(--ds-primary), #7c3aed);
    border-radius: 3px;
}

/* ============================================
   Filters
   ============================================ */
.drivers-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    padding: 24px;
    background: var(--ds-gray-50);
    border-radius: var(--ds-radius);
    border: 1px solid var(--ds-gray-200);
    margin-bottom: 28px;
}

.drivers-filters p {
    margin: 0;
    display: flex;
    flex-direction: column;
}

.drivers-filters label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--ds-gray-700);
    margin-bottom: 8px;
}

.drivers-filters select {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    font-family: inherit;
    color: var(--ds-gray-800);
    background: #fff;
    border: 2px solid var(--ds-gray-200);
    border-radius: var(--ds-radius-sm);
    transition: var(--ds-transition);
    outline: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 16px center;
    padding-left: 44px;
}

.drivers-filters select:focus {
    border-color: var(--ds-primary);
    box-shadow: 0 0 0 4px var(--ds-primary-light);
}

.drivers-filters select:disabled {
    background-color: var(--ds-gray-100);
    color: var(--ds-gray-400);
    cursor: not-allowed;
}

/* ============================================
   Results Container
   ============================================ */
.drivers-results {
    min-height: 120px;
    padding: 20px 0;
}

.drivers-results > p {
    text-align: center;
    color: var(--ds-gray-500);
    font-size: 15px;
    padding: 30px 20px;
    background: var(--ds-gray-50);
    border-radius: var(--ds-radius);
    border: 1px dashed var(--ds-gray-300);
    margin: 0;
}

/* ============================================
   Driver Cards Grid
   ============================================ */
.drivers-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
}

.drivers-results > p {
    grid-column: 1 / -1;
}

.driver-card {
    background: #fff;
    border-radius: var(--ds-radius);
    overflow: hidden;
    border: 1px solid var(--ds-gray-200);
    box-shadow: var(--ds-shadow-sm);
    cursor: pointer;
    transition: var(--ds-transition);
    position: relative;
}

.driver-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--ds-shadow-md);
    border-color: var(--ds-primary);
}

.driver-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    display: block;
    background: var(--ds-gray-100);
    transition: transform 0.4s ease;
}

.driver-card:hover img {
    transform: scale(1.05);
}

.driver-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--ds-secondary);
    margin: 0;
    padding: 16px 18px;
    text-align: center;
    background: #fff;
    border-top: 1px solid var(--ds-gray-100);
}

/* ============================================
   Driver Details View
   ============================================ */
.driver-details {
    grid-column: 1 / -1;
    background: #fff;
    border-radius: var(--ds-radius-lg);
    padding: 32px;
    border: 1px solid var(--ds-gray-200);
    box-shadow: var(--ds-shadow);
    animation: dsFadeIn 0.35s ease;
}

@keyframes dsFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.driver-details button#drivers-back {
    background: var(--ds-gray-100);
    color: var(--ds-gray-700);
    border: none;
    padding: 10px 20px;
    border-radius: var(--ds-radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 24px;
    transition: var(--ds-transition);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.driver-details button#drivers-back:hover {
    background: var(--ds-gray-200);
    color: var(--ds-secondary);
    transform: translateX(4px);
}

.driver-details img {
    width: 100%;
    max-height: 340px;
    object-fit: cover;
    border-radius: var(--ds-radius);
    display: block;
    margin-bottom: 24px;
    background: var(--ds-gray-100);
    box-shadow: var(--ds-shadow-sm);
}

.driver-details h2 {
    font-size: 26px;
    font-weight: 700;
    color: var(--ds-secondary);
    margin: 0 0 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--ds-gray-100);
}

.driver-details p {
    font-size: 15px;
    color: var(--ds-gray-700);
    margin: 0 0 14px;
    padding: 14px 18px;
    background: var(--ds-gray-50);
    border-radius: var(--ds-radius-sm);
    border-right: 3px solid var(--ds-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.driver-details p strong {
    color: var(--ds-secondary);
    font-weight: 700;
    min-width: 100px;
}

/* ============================================
   Admin Page Enhancements
   ============================================ */
.wrap .driver-registration-success {
    margin: 20px 0;
}

/* ============================================
   Responsive Design
   ============================================ */
@media (max-width: 768px) {
    .drivers-registration,
    .drivers-page {
        margin: 20px 12px;
        padding: 24px 20px;
        border-radius: var(--ds-radius);
    }

    .drivers-registration h2,
    .drivers-page h2 {
        font-size: 22px;
    }

    .drivers-filters {
        grid-template-columns: 1fr;
        padding: 18px;
    }

    .drivers-results {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 14px;
    }

    .driver-card img {
        height: 130px;
    }

    .driver-details {
        padding: 22px 18px;
    }

    .driver-details h2 {
        font-size: 21px;
    }

    .driver-details p {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

@media (max-width: 480px) {
    .drivers-results {
        grid-template-columns: 1fr;
    }

    .drivers-registration input,
    .drivers-registration select {
        font-size: 14px;
        padding: 12px 14px;
    }
}

/* ============================================
   Loading State
   ============================================ */
.drivers-results > p:contains("جاري") {
    color: var(--ds-primary);
    background: var(--ds-primary-light);
    border-color: var(--ds-primary);
    border-style: solid;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .drivers-registration button,
    .drivers-filters,
    .driver-details button {
        display: none !important;
    }

    .drivers-registration,
    .drivers-page {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}