/* ========================================
   Wedding Hall Management System - Dashboard CSS
   ======================================== */

/* Color Palette */
:root {
    --primary-navy: #1e3a5f;
    --secondary-navy: #2c4f7c;
    --emerald-green: #10b981;
    --amber-warning: #f59e0b;
    --danger-red: #ef4444;
    --light-gray: #f8f9fa;
    --medium-gray: #e5e7eb;
    --dark-gray: #6b7280;
    --white: #ffffff;
    --sidebar-width: 260px;
    --navbar-height: 64px;
    --transition-speed: 0.3s;
}

/* ========================================
   Outstanding Payments Page Styles
   ======================================== */

.table-success-light {
    background-color: rgba(16, 185, 129, 0.1);
}

.table-warning-light {
    background-color: rgba(245, 158, 11, 0.1);
}

.table-danger-light {
    background-color: rgba(239, 68, 68, 0.1);
}

.avatar-sm {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    text-transform: uppercase;
}

.stats-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.stats-card.warning {
    background: linear-gradient(135deg, #f59e0b, #f97316);
    color: white;
}

.stats-card.success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.stats-card.info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.stats-card .stats-label {
    font-size: 0.875rem;
    opacity: 0.9;
    margin-bottom: 4px;
}

.stats-card .stats-value {
    font-size: 1.75rem;
    font-weight: bold;
    line-height: 1;
}

.stats-card .stats-icon {
    font-size: 2rem;
    opacity: 0.8;
}

.progress {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.progress-bar {
    font-size: 0.75rem;
    font-weight: 600;
    transition: width 0.6s ease;
}

.btn-group .btn {
    border-radius: 6px;
    margin: 0 2px;
}

.card-header .form-control,
.card-header .form-select {
    border-radius: 6px;
    border: 1px solid #ddd;
    padding: 0.375rem 0.75rem;
}

.card-header .form-control:focus,
.card-header .form-select:focus {
    border-color: var(--primary-navy);
    box-shadow: 0 0 0 0.2rem rgba(30, 58, 95, 0.25);
}

/* Print-friendly styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .stats-card {
        background: white !important;
        color: black !important;
        border: 1px solid #ddd !important;
        margin-bottom: 10px;
    }
    
    .table {
        font-size: 12px;
    }
    
    .progress {
        border: 1px solid #ddd;
        background: white !important;
    }
    
    .progress-bar {
        background: #ddd !important;
        color: black !important;
    }
}

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

body {
    font-family: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-gray);
    color: #333;
    overflow-x: hidden;
}

/* ========================================
   Layout Structure
   ======================================== */
.wrapper {
    display: flex;
    width: 100%;
    min-height: 100vh;
    position: relative;
}

/* ========================================
   Sidebar Styles
   ======================================== */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-navy) 0%, var(--secondary-navy) 100%);
    color: var(--white);
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    z-index: 1050;
    transition: transform var(--transition-speed) ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--white);
}

.sidebar-brand i {
    font-size: 1.75rem;
    color: var(--emerald-green);
}

.brand-text {
    line-height: 1.2;
}

.sidebar-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    display: none;
    position: relative;
    z-index: 1060;
    min-width: 44px;
    min-height: 44px;
    display: none;
    align-items: center;
    justify-content: center;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1rem 0;
    scroll-behavior: smooth;
    /* Ensure smooth scrolling works consistently */
    -webkit-overflow-scrolling: touch;
}

/* Custom Scrollbar for Sidebar */
.sidebar-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.35) rgba(255, 255, 255, 0.08);
}

.sidebar-content::-webkit-scrollbar {
    width: 10px;
}

.sidebar-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 5px;
    margin: 4px 0;
}

.sidebar-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.35);
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.55);
    background-clip: padding-box;
}

.sidebar-content::-webkit-scrollbar-thumb:active {
    background: rgba(255, 255, 255, 0.7);
    background-clip: padding-box;
}

/* Navigation List */
.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-item {
    margin-bottom: 0.25rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    color: rgba(255, 255, 255, 0.85);
    text-decoration: none;
    transition: all var(--transition-speed) ease;
    position: relative;
    font-size: 0.95rem;
    font-weight: 500;
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
    padding-right: 1.5rem;
}

.nav-link.active {
    background-color: var(--emerald-green);
    color: var(--white);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    position: relative;
    /* Add subtle animation for active state */
    animation: activeLinkPulse 2s ease-in-out infinite;
}

@keyframes activeLinkPulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
    }
    50% {
        box-shadow: 0 2px 12px rgba(16, 185, 129, 0.5);
    }
}

.nav-link i:first-child {
    width: 24px;
    margin-left: 0.75rem;
    font-size: 1.1rem;
    text-align: center;
}

.submenu-arrow {
    font-size: 0.75rem;
    transition: transform var(--transition-speed) ease;
}

.nav-link[aria-expanded="true"] .submenu-arrow {
    transform: rotate(180deg);
}

/* Submenu */
.submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    background-color: rgba(0, 0, 0, 0.15);
}

.submenu li {
    margin: 0;
}

.submenu a {
    display: block;
    padding: 0.75rem 3.5rem 0.75rem 1.25rem;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all var(--transition-speed) ease;
}

.submenu a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--white);
    padding-left: 3.75rem;
}

.submenu a.active {
    color: var(--emerald-green);
    font-weight: 600;
    background-color: rgba(16, 185, 129, 0.1);
    border-right: 3px solid var(--emerald-green);
    position: relative;
    transition: all var(--transition-speed) ease;
}

.submenu a.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--emerald-green);
    animation: activeSubmenuGlow 2s ease-in-out infinite;
}

@keyframes activeSubmenuGlow {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 5px rgba(16, 185, 129, 0.5);
    }
    50% {
        opacity: 0.7;
        box-shadow: 0 0 8px rgba(16, 185, 129, 0.8);
    }
}

/* ========================================
   Content Area
   ======================================== */
.content {
    flex: 1;
    margin-right: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-right var(--transition-speed) ease;
}

/* Top Navbar */
.navbar {
    height: var(--navbar-height);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 1040;
}

.navbar .btn-link {
    color: var(--dark-gray);
    text-decoration: none;
    padding: 0.5rem;
}

.navbar .btn-link:hover {
    color: var(--primary-navy);
}

/* Breadcrumb */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
}

.breadcrumb-item a {
    color: var(--dark-gray);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: var(--primary-navy);
}

.breadcrumb-item.active {
    color: var(--primary-navy);
    font-weight: 600;
}

/* Notification Dropdown */
.notification-dropdown {
    width: 320px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.notification-item i {
    font-size: 1.25rem;
    margin-top: 0.25rem;
}

.notification-content {
    flex: 1;
}

.notification-content strong {
    display: block;
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

/* User Profile */
.user-avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: #333;
}

/* Content Wrapper */
.content-wrapper {
    flex: 1;
    padding: 2rem 0;
    background-color: var(--light-gray);
}

/* ========================================
   Footer
   ======================================== */
.footer {
    background-color: var(--white);
    border-top: 1px solid var(--medium-gray);
    padding: 1.5rem 0;
    margin-top: auto;
}

/* ========================================
   Sidebar Overlay (Mobile)
   ======================================== */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    display: none;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-speed) ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
    pointer-events: auto;
}

/* ========================================
   Loading Spinner
   ======================================== */
.loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner.active {
    display: flex;
}

.loading-spinner .spinner-border {
    width: 3rem;
    height: 3rem;
}

/* ========================================
   Cards & Components
   ======================================== */
.card {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.card-header {
    background-color: var(--white);
    border-bottom: 2px solid var(--light-gray);
    font-weight: 600;
    color: var(--primary-navy);
}

/* Stats Cards */
.stats-card {
    background: linear-gradient(135deg, var(--primary-navy) 0%, var(--secondary-navy) 100%);
    color: var(--white);
    border-radius: 0.75rem;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.stats-card.success {
    background: linear-gradient(135deg, var(--emerald-green) 0%, #059669 100%);
}

.stats-card.warning {
    background: linear-gradient(135deg, var(--amber-warning) 0%, #d97706 100%);
}

.stats-card.danger {
    background: linear-gradient(135deg, var(--danger-red) 0%, #dc2626 100%);
}

.stats-icon {
    font-size: 2.5rem;
    opacity: 0.9;
}

.stats-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 0.5rem 0;
}

.stats-label {
    font-size: 0.9rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Buttons */
.btn-primary {
    background-color: var(--primary-navy);
    border-color: var(--primary-navy);
    font-weight: 600;
    padding: 0.625rem 1.5rem;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background-color: var(--secondary-navy);
    border-color: var(--secondary-navy);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(30, 58, 95, 0.3);
}

.btn-success {
    background-color: var(--emerald-green);
    border-color: var(--emerald-green);
    font-weight: 600;
}

.btn-success:hover {
    background-color: #059669;
    border-color: #059669;
}

.btn-warning {
    background-color: var(--amber-warning);
    border-color: var(--amber-warning);
    font-weight: 600;
}

.btn-danger {
    background-color: var(--danger-red);
    border-color: var(--danger-red);
    font-weight: 600;
}

/* Badges */
.badge {
    font-weight: 600;
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.badge-pending {
    background-color: var(--amber-warning);
}

.badge-confirmed {
    background-color: var(--emerald-green);
}

.badge-cancelled {
    background-color: var(--danger-red);
}

.badge-completed {
    background-color: #6b7280;
}

/* Tables */
.table {
    background-color: var(--white);
}

.table thead th {
    background-color: var(--light-gray);
    color: var(--primary-navy);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--medium-gray);
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: var(--light-gray);
}

/* ========================================
   Responsive Design
   ======================================== */

/* إخفاء عرض الكاردات على الشاشات الكبيرة */
.mobile-card-view {
    display: none;
}

/* Tablet and below */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-close {
        display: block;
    }

    .content {
        margin-right: 0;
    }

    .stats-card {
        margin-bottom: 1rem;
    }
}

/* Mobile */
@media (max-width: 767.98px) {
    .content-wrapper {
        padding: 1rem 0;
    }

    .navbar {
        height: auto;
        padding: 0.75rem 0;
    }

    .user-name,
    .user-name + small {
        display: none !important;
    }

    .stats-value {
        font-size: 1.5rem;
    }

    .stats-icon {
        font-size: 2rem;
    }

    .card {
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .table-responsive {
        font-size: 0.875rem;
    }

    /* تحويل الجداول إلى كاردات على الموبايل (شرط وجود الكاردات) */
    .has-mobile-cards table {
        display: none !important;
    }

    .has-mobile-cards::after {
        content: '';
        display: block;
    }

    .mobile-card-view {
        display: block !important;
        padding: 0;
        overflow: visible;
        width: 100%;
        max-width: 100%;
    }

    .mobile-card-item {
        background: white;
        border: 1px solid #e0e0e0;
        border-radius: 8px;
        padding: 0.875rem;
        margin-bottom: 0.75rem;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }

    .mobile-card-item .card-row {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 0.5rem 0;
        border-bottom: 1px solid #f5f5f5;
        gap: 0.5rem;
        flex-wrap: wrap;
    }

    .mobile-card-item .card-row:last-child {
        border-bottom: none;
    }

    .mobile-card-item .card-label {
        font-weight: 600;
        color: #666;
        font-size: 0.8rem;
        flex-shrink: 0;
        word-break: break-word;
    }

    .mobile-card-item .card-value {
        color: #333;
        font-size: 0.85rem;
        text-align: left;
        word-break: break-word;
        overflow-wrap: break-word;
    }

    .mobile-card-item .card-actions {
        display: flex;
        gap: 0.5rem;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        border-top: 1px solid #f5f5f5;
    }

    .mobile-card-item .btn-sm {
        font-size: 0.8rem;
        padding: 0.35rem 0.75rem;
    }
}

/* Small mobile */
@media (max-width: 575.98px) {
    .sidebar {
        width: 280px;
    }

    .breadcrumb {
        font-size: 0.85rem;
    }

    .notification-dropdown {
        width: 280px;
    }
}

/* ========================================
   Utility Classes
   ======================================== */
.text-navy {
    color: var(--primary-navy) !important;
}

.bg-navy {
    background-color: var(--primary-navy) !important;
}

.text-emerald {
    color: var(--emerald-green) !important;
}

.bg-emerald {
    background-color: var(--emerald-green) !important;
}

.shadow-sm-hover:hover {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.transition-all {
    transition: all var(--transition-speed) ease;
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-navy);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--dark-gray);
    font-size: 1rem;
}

/* Quick Actions */
.quick-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.quick-action-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.quick-action-btn i {
    font-size: 1.25rem;
}

/* Alert Styles */
.alert {
    border-radius: 0.5rem;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
}

.alert-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
}

.alert-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Print Styles */
@media print {
    .sidebar,
    .navbar,
    .footer,
    .quick-actions {
        display: none !important;
    }

    .content {
        margin-right: 0;
        padding: 1rem;
    }

    .content-wrapper {
        padding: 0 !important;
    }
}
