/* =============================================
   Clinic Management System - Components
   ============================================= */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: var(--transition-fast);
    cursor: pointer;
    border: none;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary-light);
    color: var(--text-white);
}

.btn-primary:hover {
    background: var(--btn-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: var(--btn-secondary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--btn-secondary-hover);
}

.btn-success {
    background: var(--success);
    color: var(--text-white);
}

.btn-danger {
    background: var(--danger);
    color: var(--text-white);
}

.btn-warning {
    background: var(--warning);
    color: var(--text-white);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--primary-light);
    color: var(--primary-light);
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--border-radius);
}

.btn-icon.sm {
    width: 30px;
    height: 30px;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-heading);
    margin-bottom: 0.5rem;
}

.form-label.required::after {
    content: '*';
    color: var(--danger);
    margin-left: 4px;
}

.form-control {
    width: 100%;
    height: 44px;
    padding: 0 1rem;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 0.9375rem;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-control.error {
    border-color: var(--danger);
}

textarea.form-control {
    height: auto;
    min-height: 100px;
    padding: 0.875rem 1rem;
    resize: vertical;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236B7280' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 1rem center;
    /* Changed from right for RTL */
    padding-left: 2.5rem;
    /* Changed from padding-right for RTL */
    padding-right: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.input-icon-wrapper {
    position: relative;
}

.input-icon-wrapper .form-control {
    padding-right: 2.75rem;
    /* Changed from padding-left for RTL */
    padding-left: 1rem;
}

.input-icon-wrapper i {
    position: absolute;
    right: 1rem;
    /* Changed from left for RTL */
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

/* Tables */
.table-container {
    background: var(--bg-white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.table-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}

.table-header h3 {
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.table-header h3 i {
    color: var(--primary-light);
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.table-search {
    position: relative;
    width: 250px;
}

.table-search input {
    width: 100%;
    height: 38px;
    padding: 0 2.5rem 0 1rem;
    /* Changed from 0 1rem 0 2.5rem for RTL */
    background: var(--bg-light);
    border: 1px solid transparent;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
}

.table-search input:focus {
    background: var(--bg-white);
    border-color: var(--primary-light);
}

.search-box {
    display: flex;
    align-items: center;
    background: #f3f4f6;
    border-radius: 12px;
    padding: 0 1rem;
    width: 300px;
    height: 44px;
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.search-box:focus-within {
    background: #fff;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.search-box i {
    color: #9ca3af;
    width: 18px;
    height: 18px;
    margin-left: 10px;
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text-dark);
}

.search-box input::placeholder {
    color: #9ca3af;
}

.table-search i {
    position: absolute;
    right: 0.875rem;
    /* Changed from left for RTL */
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem 1.5rem;
    text-align: right;
    /* Changed from left for RTL */
}

.data-table th {
    background: var(--bg-light);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    font-size: 0.9375rem;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

.data-table tbody tr:hover {
    background: rgba(59, 130, 246, 0.03);
}

.table-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.table-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: var(--primary-light);
}

.table-user-info h4 {
    font-size: 0.9375rem;
    margin-bottom: 2px;
}

.table-user-info span {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.active,
.status-badge.paid,
.status-badge.completed {
    background: var(--success-light);
    color: var(--success);
}

.status-badge.inactive,
.status-badge.unpaid,
.status-badge.cancelled {
    background: var(--danger-light);
    color: var(--danger);
}

.status-badge.pending,
.status-badge.booked {
    background: var(--warning-light);
    color: var(--warning);
}

.table-row-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.table-row-actions .btn-icon {
    background: var(--bg-light);
    color: var(--text-secondary);
}

.table-row-actions .btn-icon:hover {
    background: var(--primary-light);
    color: var(--text-white);
}

.table-row-actions .btn-icon.delete:hover {
    background: var(--danger);
}

/* Pagination */
.table-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-light);
}

.table-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.pagination {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    color: var(--text-secondary);
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    cursor: pointer;
}

.pagination-btn:hover {
    border-color: var(--primary-light);
    color: var(--primary-light);
}

.pagination-btn.active {
    background: var(--primary-light);
    border-color: var(--primary-light);
    color: var(--text-white);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-white);
    border-radius: var(--border-radius-xl);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: var(--transition);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal.lg {
    max-width: 800px;
}

.modal.xl {
    max-width: 1000px;
}

.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 1.125rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-header h3 i {
    color: var(--primary-light);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
}

.modal-close:hover {
    background: var(--bg-light);
    color: var(--danger);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 140px);
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    background: var(--bg-light);
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.tab-btn {
    padding: 1rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
}

.tab-btn::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-light);
    transform: scaleX(0);
    transition: var(--transition-fast);
}

.tab-btn:hover,
.tab-btn.active {
    color: var(--primary-light);
}

.tab-btn.active::after {
    transform: scaleX(1);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Alerts */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
}

.alert.success {
    background: var(--success-light);
    border-right: 3px solid var(--success);
    /* Changed from border-left for RTL */
}

.alert.warning {
    background: var(--warning-light);
    border-right: 3px solid var(--warning);
    /* Changed from border-left for RTL */
}

.alert.danger {
    background: var(--danger-light);
    border-right: 3px solid var(--danger);
    /* Changed from border-left for RTL */
}

.alert.info {
    background: var(--info-light);
    border-right: 3px solid var(--info);
    /* Changed from border-left for RTL */
}

/* Toast */
.toast-container {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--bg-white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Calendar */
.calendar {
    background: var(--bg-white);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
}

.calendar-header {
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--primary-gradient);
    color: var(--text-white);
}

.calendar-header h3 {
    color: var(--text-white);
    font-size: 1.125rem;
}

.calendar-nav {
    display: flex;
    gap: 0.5rem;
}

.calendar-nav button {
    width: 32px;
    height: 32px;
    border-radius: var(--border-radius);
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-white);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
}

.calendar-day-header {
    padding: 0.75rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    background: var(--bg-light);
}

.calendar-day {
    padding: 0.5rem;
    min-height: 100px;
    border: 1px solid var(--border-color);
    border-top: none;
    cursor: pointer;
}

.calendar-day:hover {
    background: rgba(59, 130, 246, 0.05);
}

.calendar-day.today {
    background: rgba(59, 130, 246, 0.1);
}

.day-number {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.calendar-day.today .day-number {
    background: var(--primary-light);
    color: var(--text-white);
}

.calendar-event {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.calendar-event.doctor-1 {
    background: #DBEAFE;
    color: #1E40AF;
}

.calendar-event.doctor-2 {
    background: #D1FAE5;
    color: #065F46;
}

.calendar-event.doctor-3 {
    background: #FEF3C7;
    color: #92400E;
}

/* File Upload */
.file-upload {
    border: 2px dashed var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
}

.file-upload:hover {
    border-color: var(--primary-light);
    background: rgba(59, 130, 246, 0.05);
}

.file-upload i {
    font-size: 2.5rem;
    color: var(--primary-light);
    margin-bottom: 1rem;
}

.file-upload h4 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.file-upload p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
}

.empty-state i {
    font-size: 4rem;
    color: var(--border-color);
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Loading */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* =============================================
   Notifications System - Premium Design
   ============================================= */

/* Notification Button Enhancement */
.header-icon#notificationBtn {
    position: relative;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-icon#notificationBtn:hover {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary-light);
    transform: scale(1.05);
}

.notification-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 10px;
    height: 10px;
    background: #ef4444;
    border: 2px solid #fff;
    border-radius: 50%;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(239, 68, 68, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Dropdown Panel */
.notifications-dropdown {
    position: absolute;
    top: calc(100% + 15px);
    left: 0;
    width: 380px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.05);
    visibility: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.1);
    z-index: 1100;
    overflow: hidden;
}

.notifications-dropdown.active {
    visibility: visible;
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Arrow indicator */
.notifications-dropdown::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 15px;
    width: 16px;
    height: 16px;
    background: #fff;
    transform: rotate(45deg);
    border-left: 1px solid rgba(0, 0, 0, 0.05);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.notifications-header {
    padding: 1.25rem 1.5rem;
    background: #fcfcfd;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notifications-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.notifications-header .badge {
    background: var(--primary-light);
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
}

.notification-list {
    max-height: 420px;
    overflow-y: auto;
    scrollbar-width: thin;
}

.notification-list::-webkit-scrollbar {
    width: 6px;
}

.notification-list::-webkit-scrollbar-thumb {
    background: #e5e7eb;
    border-radius: 10px;
}

.notification-item {
    display: flex;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #f9fafb;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.notification-item:hover {
    background: #f8fafc;
}

.notification-item.unread {
    background: rgba(59, 130, 246, 0.03);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: var(--primary-light);
    border-radius: 50%;
}

.notification-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.2rem;
}

.notification-icon.warning {
    background: #fffbeb;
    color: #d97706;
}

.notification-icon.danger {
    background: #fef2f2;
    color: #dc2626;
}

.notification-icon.info {
    background: #eff6ff;
    color: #2563eb;
}

.notification-icon.success {
    background: #f0fdf4;
    color: #16a34a;
}

.notification-content {
    flex: 1;
}

.notification-content h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 3px;
}

.notification-content p {
    font-size: 0.8125rem;
    color: #4b5563;
    line-height: 1.5;
    margin: 0;
}

.notification-content span {
    font-size: 0.75rem;
    color: #9ca3af;
    display: block;
    margin-top: 6px;
}

.notifications-footer {
    padding: 1rem;
    text-align: center;
    background: #fcfcfd;
    border-top: 1px solid #f3f4f6;
}

.notifications-footer a {
    font-size: 0.875rem;
    color: var(--primary-light);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.notifications-footer a:hover {
    color: #1d4ed8;
}

/* Empty State Styling */
.notification-list .empty-state {
    padding: 3rem 2rem;
    text-align: center;
}

.notification-list .empty-state i {
    font-size: 2.5rem;
    color: #e5e7eb;
    margin-bottom: 1rem;
    display: block;
}

.notification-list .empty-state p {
    color: #9ca3af;
    font-size: 0.9375rem;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .notifications-dropdown {
        width: 320px;
        left: -80px;
    }

    .notifications-dropdown::before {
        left: 95px;
    }
}