/* ============================================
   عيادة السوسن - أستايل CSS
   ============================================ */

:root {
    --primary-color: #4a90e2;
    --secondary-color: #5cb85c;
    --danger-color: #d9534f;
    --warning-color: #f0ad4e;
    --info-color: #5bc0de;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --success-color: #28a745;
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    direction: rtl;
}

/* تنشيط الروابط في الشريط العلوي */
.navbar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.1) !important;
    border-radius: 5px;
    font-weight: bold;
}

.navbar-nav .nav-link {
    cursor: pointer;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
    transform: translateY(-1px);
}

.dropdown-item {
    cursor: pointer;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: #16181b;
}

/* أزرار مخصصة */
.btn-custom {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

.btn-primary-custom:hover {
    background: #3a7bc8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.btn-success-custom {
    background: var(--success-color);
    color: white;
}

.btn-success-custom:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.btn-danger-custom {
    background: var(--danger-color);
    color: white;
}

.btn-danger-custom:hover {
    background: #c9302c;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(217, 83, 79, 0.3);
}

.btn-secondary-custom {
    background: #6c757d;
    color: white;
}

.btn-secondary-custom:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(108, 117, 125, 0.3);
}

.btn-info-custom {
    background: var(--info-color);
    color: white;
}

.btn-info-custom:hover {
    background: #5bc0de;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(91, 192, 222, 0.3);
}

/* البطاقات */
.card-custom {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: none;
}

.card-custom:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.card-header-custom {
    background: linear-gradient(135deg, var(--primary-color), #667eea);
    color: white;
    padding: 20px;
    font-weight: 700;
    font-size: 1.2rem;
    border: none;
}

.card-body-custom {
    padding: 25px;
}

/* النماذج */
.form-control-custom {
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.form-control-custom:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(74, 144, 226, 0.25);
    background: white;
}

.form-label-custom {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 8px;
}

/* الجداول */
.table-custom {
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.table-custom thead {
    background: linear-gradient(135deg, var(--primary-color), #667eea);
    color: white;
}

.table-custom tbody tr:hover {
    background: rgba(74, 144, 226, 0.05);
}

/* التنبيهات */
.alert-custom {
    border: none;
    border-radius: 10px;
    padding: 15px 20px;
    font-weight: 500;
    margin-bottom: 20px;
}

.alert-success-custom {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.alert-danger-custom {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

.alert-warning-custom {
    background: linear-gradient(135deg, #ffc107, #e0a800);
    color: #212529;
}

/* الطوابير */
.queue-item {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    border-right: 5px solid var(--primary-color);
    transition: all 0.3s ease;
}

.queue-item:hover {
    transform: translateX(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
}

.queue-number {
    background: var(--primary-color);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: bold;
    margin-left: 15px;
}

/* الفواتير */
.invoice-card {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2);
}

.invoice-total {
    font-size: 2rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

/* الإحصائيات */
.stat-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border-top: 4px solid var(--primary-color);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.stat-label {
    color: #6c757d;
    font-size: 1rem;
    font-weight: 600;
}

/* الإحصائيات الصغيرة */
.stat-card-small {
    background: white;
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border-top: 3px solid var(--primary-color);
}

.stat-card-small:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.stat-number-small {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.stat-label-small {
    color: #6c757d;
    font-size: 0.85rem;
    font-weight: 500;
}

/* صفحة تسجيل الدخول */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 450px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h2 {
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 10px;
}

/* تأثيرات الحركة */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(74, 144, 226, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(74, 144, 226, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(74, 144, 226, 0);
    }
}

.pulse {
    animation: pulse 2s infinite;
}

/* التصميم المتجاوب */
@media (max-width: 768px) {
    .card-custom {
        margin: 10px;
    }

    .queue-item {
        padding: 15px;
    }

    .login-card {
        margin: 20px;
        padding: 30px;
    }

    .stat-card {
        margin-bottom: 20px;
    }
}

/* تحميل */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* الألوان المخصصة للحالات */
.status-waiting { color: #ffc107; }
.status-in-progress { color: #17a2b8; }
.status-completed { color: #28a745; }
.status-cancelled { color: #dc3545; }

/* ==========================
   A5 Landscape Invoice Styling
   ========================== */
.invoice-a5-landscape {
    width: 210mm;
    height: 148mm;
    background: white;
    margin: 0 auto;
    padding: 15mm;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    direction: rtl;
    display: flex;
    flex-direction: column;
}

.invoice-header {
    text-align: center;
    margin-bottom: 20px;
    border-bottom: 3px solid var(--primary-color);
    padding-bottom: 15px;
}

.invoice-header h2 {
    color: var(--primary-color);
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 5px;
}

.invoice-header p {
    color: #666;
    margin: 0;
    font-size: 14px;
}

.invoice-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
    font-size: 14px;
}

.invoice-info-section {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.invoice-info-section h4 {
    color: var(--primary-color);
    font-size: 16px;
    margin-bottom: 8px;
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 4px;
}

.invoice-info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    align-items: center;
}

.invoice-info-row strong {
    color: #495057;
}

.invoice-services-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    font-size: 14px;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.invoice-services-table th {
    background: var(--primary-color);
    color: white;
    padding: 12px;
    text-align: center;
    font-weight: 600;
    border: 1px solid #007bff;
}

.invoice-services-table td {
    padding: 10px 12px;
    text-align: center;
    border-bottom: 1px solid #dee2e6;
    border-left: 1px solid #dee2e6;
}

.invoice-services-table tr:nth-child(even) {
    background: #f8f9fa;
}

.invoice-totals-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: auto;
    padding-top: 20px;
    border-top: 2px solid #dee2e6;
}

.invoice-payment-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #ced4da;
}

.invoice-payment-section h4 {
    color: var(--primary-color);
    font-size: 16px;
    margin-bottom: 12px;
    text-align: center;
}

.payment-method-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.payment-method-btn {
    flex: 1;
    padding: 8px;
    border: 2px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.payment-method-btn.active {
    background: var(--primary-color);
    color: white;
}

.payment-method-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(74, 144, 226, 0.3);
}

.payment-type-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.payment-type-btn {
    flex: 1;
    padding: 8px;
    border: 2px solid var(--success-color);
    background: white;
    color: var(--success-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.payment-type-btn.active {
    background: var(--success-color);
    color: white;
}

.partial-payment-input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    margin-bottom: 15px;
    transition: border-color 0.3s ease;
}

.partial-payment-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.invoice-summary-section {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    padding: 15px;
    border-radius: 10px;
    border: 1px solid #90caf9;
}

.invoice-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 14px;
}

.invoice-summary-row.total {
    font-weight: bold;
    font-size: 16px;
    color: var(--primary-color);
    border-top: 2px solid var(--primary-color);
    padding-top: 8px;
    margin-top: 8px;
}

.invoice-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.invoice-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 120px;
}

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

.invoice-btn-success {
    background: var(--success-color);
    color: white;
}

.invoice-btn-secondary {
    background: #6c757d;
    color: white;
}

.invoice-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Modal adjustments for A5 landscape */
.modal-dialog.invoice-modal {
    max-width: 95vw;
    width: 900px;
}

.modal-content.invoice-modal-content {
    background: #f5f5f5;
}

.modal-body.invoice-modal-body {
    padding: 20px;
    max-height: 85vh;
    overflow-y: auto;
}

/* Print styles for A5 landscape */
@media print {
    .invoice-modal-body {
        overflow: visible;
    }

    .invoice-actions {
        display: none;
    }

    body .modal {
        position: static;
        background: white;
    }

    body .modal-content {
        box-shadow: none;
        border: none;
    }
}

/* ============================================
   Payment System Styles
   ============================================ */

/* Payment Status Banner */
.payment-status-banner {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 20px;
    margin: 15px 0;
    border-radius: 10px;
    border: 2px solid;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
}

.payment-status-banner.paid {
    border-color: var(--success-color);
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
}

.payment-status-banner.partial {
    border-color: var(--warning-color);
    background: linear-gradient(135deg, #fff3cd 0%, #fdeaa7 100%);
}

.payment-status-banner.unpaid {
    border-color: var(--danger-color);
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
}

.payment-status-icon {
    font-size: 2rem;
    color: var(--primary-color);
}

.payment-status-icon .fa-check-circle {
    color: var(--success-color);
}

.payment-status-icon .fa-clock {
    color: var(--warning-color);
}

.payment-status-icon .fa-times-circle {
    color: var(--danger-color);
}

.payment-status-text h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--dark-color);
}

.payment-status-text p {
    margin: 5px 0 0 0;
    font-size: 0.9rem;
    color: #6c757d;
}

/* Payment Modal Enhancements */
#paymentModal .modal-dialog {
    max-width: 1000px;
}

.payment-summary-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #e9ecef;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.payment-method-buttons {
    display: flex;
    gap: 10px;
    margin: 10px 0;
}

.payment-method-btn {
    flex: 1;
    padding: 12px;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.payment-method-btn:hover {
    border-color: var(--primary-color);
    background: rgba(74, 144, 226, 0.05);
}

.payment-method-btn.active {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
}

.payment-type-buttons {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.payment-type-btn {
    flex: 1;
    padding: 10px;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.payment-type-btn:hover {
    border-color: var(--success-color);
    background: rgba(40, 167, 69, 0.05);
}

.payment-type-btn.active {
    border-color: var(--success-color);
    background: var(--success-color);
    color: white;
}

.partial-payment-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    margin: 10px 0;
    transition: border-color 0.3s ease;
}

.partial-payment-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* Payment History Table */
.payment-history-table {
    margin-top: 15px;
}

.payment-history-table .table {
    font-size: 0.9rem;
}

.payment-history-table .badge {
    font-size: 0.8rem;
    padding: 5px 8px;
}

/* Payment Progress Animation */
.progress {
    overflow: visible;
}

.progress-bar {
    position: relative;
    transition: width 0.6s ease;
}

/* Payment Button Loading State */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Payment Success Animation */
.payment-success {
    animation: paymentPulse 0.6s ease;
}

@keyframes paymentPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Quick Amount Buttons */
.quick-amount-btn {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.85rem;
    font-weight: 500;
}

.quick-amount-btn:hover {
    border-color: var(--primary-color);
    background: var(--primary-color);
    color: white;
    transform: translateY(-1px);
}

/* Payment Status Badges */
.payment-status-badge {
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Enhanced Invoice Modal with Payment Integration */
.invoice-enhanced {
    position: relative;
}

.invoice-payment-section {
    background: linear-gradient(135deg, #e8f5e8 0%, #f0f9f0 100%);
    border: 1px solid #c3e6cb;
    border-radius: 10px;
    padding: 20px;
    margin: 15px 0;
}

.invoice-payment-section h4 {
    color: var(--success-color);
    margin-bottom: 15px;
    text-align: center;
}

/* Payment Alert Styles */
.payment-alert {
    margin-top: 10px;
    padding: 12px 15px;
    border-radius: 8px;
    font-weight: 500;
}

.payment-alert-success {
    background: rgba(40, 167, 69, 0.1);
    border: 1px solid rgba(40, 167, 69, 0.3);
    color: var(--success-color);
}

.payment-alert-danger {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid rgba(220, 53, 69, 0.3);
    color: var(--danger-color);
}

/* Responsive Design for Payment Modals */
@media (max-width: 768px) {
    #paymentModal .modal-dialog {
        max-width: 95vw;
        margin: 10px;
    }

    .payment-status-banner {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }

    .payment-method-buttons,
    .payment-type-buttons {
        flex-direction: column;
    }

    .invoice-actions {
        flex-direction: column;
        gap: 8px;
    }

    .invoice-btn {
        width: 100%;
        min-width: auto;
    }
}