/* Admin Dashboard Custom Styles */

/* Custom Properties */
:root {
    --primary-color: #892C8C;
    --secondary-color: #F8A02A;
    --accent-color: #f5f5f5; /* light backgrounds */
    --success-color: #10B981;
    --warning-color: #F59E0B;
    --danger-color: #EF4444;
    --info-color: #3B82F6;
}

/* Base Styles */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #374151;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #ffbe6a;
}

html {
    scrollbar-width: auto;
    scrollbar-color: var(--secondary-color) rgba(255, 255, 255, 0.15);
}

/* Sidebar Styles */
.sidebar-scroll::-webkit-scrollbar {
    width: 10px;
}

.sidebar-scroll::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
}

.sidebar-scroll::-webkit-scrollbar-thumb {
    background: var(--secondary-color);
    border-radius: 6px;
}

.sidebar-scroll::-webkit-scrollbar-thumb:hover {
    background: #ffbe6a;
}

/* Sidebar Theme (Purple background) */
.sidebar-scroll {
    background-color: var(--primary-color) !important; /* #892C8C */
    scrollbar-width: auto; /* Firefox */
    scrollbar-color: var(--secondary-color) rgba(255, 255, 255, 0.15); /* Firefox */
}

/* If markup still applies bg-secondary, force primary for the sidebar container */
.sidebar-scroll.bg-secondary {
    background-color: var(--primary-color) !important;
}

/* Mobile sidebar wrapper */
#mobileSidebar {
    background-color: var(--primary-color) !important; /* enforce purple */
}

/* .user-menu-wrapper #userDropdown,
#userDropdown {
    right: 1rem !important; 
    left: auto !important;
} */

/* Header user menu dropdown */
#user-menu {
    right: 1rem !important; /* offset from edge in RTL */
    left: auto !important;
}

/* Consistent RTL layout for logout buttons inside dropdowns */
#userDropdown button[type="submit"],
#user-menu button[type="submit"] {
    display: flex !important;
    flex-direction: row-reverse !important; /* text on the right, icon to its left */
    align-items: center !important;
    /* justify-content: flex-start !important; */
    gap: 0.5rem !important;
    white-space: nowrap !important; /* prevent chopping Arabic text */
    width: 100% !important; /* full clickable width */
}

/* Avoid text clipping by letting dropdown size to content while keeping a sensible minimum */
#userDropdown,
#user-menu {
    width: max-content !important; /* expand to fit text */
    /* min-width: 12rem !important; keep a sensible minimum */
    text-align: right !important;
    padding: 0.25rem !important; /* breathable padding around content */
}

.sidebar-nav-item {
    color: rgba(255, 255, 255, 0.85) !important;
}
.sidebar-nav-item i {
    color: inherit !important;
    opacity: 0.95;
}
.sidebar-nav-item:hover {
    background-color: rgba(255, 255, 255, 0.10) !important;
    color: #ffffff !important;
}
.sidebar-nav-item:hover i {
    color: #ffffff !important;
}

/* Logo Styles */
.sidebar-logo {
    transition: transform 0.3s ease;
}

.sidebar-logo:hover {
    transform: scale(1.05);
}

/* Sidebar Navigation Improvements */
.sidebar-nav-item {
    position: relative;
    overflow: hidden;
}

.sidebar-nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.sidebar-nav-item:hover::before {
    left: 100%;
}

/* Active state improvements */
.sidebar-nav-item.active {
    background: rgba(255, 255, 255, 0.12) !important;
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15) !important;
    color: #ffffff !important;
}
.sidebar-nav-item.active i {
    color: #ffffff !important;
}
.sidebar-nav-item.active .mr-auto.w-2.h-2 {
    background-color: #ffffff !important;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease-in-out;
    cursor: pointer;
    border: none;
    font-size: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

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

.btn-primary:hover {
    background-color: #6F216F;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

.btn-secondary:hover {
    background-color: #4B5563;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

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

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

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

/* Form Styles */
.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #D1D5DB;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: border-color 0.2s ease-in-out;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(137, 44, 140, 0.2);
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.form-text {
    font-size: 0.75rem;
    color: #6B7280;
    margin-top: 0.25rem;
}

.form-error {
    color: var(--danger-color);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Table Styles */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.table th,
.table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #E5E7EB;
}

.table th {
    background-color: #F9FAFB;
    font-weight: 600;
    color: #374151;
}

.table tbody tr:hover {
    background-color: #F9FAFB;
}

/* Card Styles */
.card {
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.card-header {
    padding: 1rem;
    border-bottom: 1px solid #E5E7EB;
    background-color: #F9FAFB;
}

.card-body {
    padding: 1rem;
}

.card-footer {
    padding: 1rem;
    border-top: 1px solid #E5E7EB;
    background-color: #F9FAFB;
}

/* Badge Styles */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background-color: #DEF7EC;
    color: #03543F;
}

.badge-warning {
    background-color: #FEF3C7;
    color: #92400E;
}

.badge-danger {
    background-color: #FDE8E8;
    color: #9B1C1C;
}

.badge-info {
    background-color: #DBEAFE;
    color: #1E40AF;
}

.badge-primary {
    background-color: #FEF3C7;
    color: #92400E;
}

/* Alert Styles */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.alert-success {
    background-color: #DEF7EC;
    border-color: #0F766E;
    color: #03543F;
}

.alert-danger {
    background-color: #FDE8E8;
    border-color: #F87171;
    color: #9B1C1C;
}

.alert-warning {
    background-color: #FEF3C7;
    border-color: #F59E0B;
    color: #92400E;
}

.alert-info {
    background-color: #DBEAFE;
    border-color: #3B82F6;
    color: #1E40AF;
}

/* Pagination Styles */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

.pagination li {
    margin: 0 0.25rem;
}

.pagination a,
.pagination span {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.375rem;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease-in-out;
}

.pagination a {
    color: #6B7280;
    border: 1px solid #D1D5DB;
    background-color: white;
}

.pagination a:hover {
    background-color: #F9FAFB;
    color: #374151;
}

.pagination .active span {
    background-color: var(--primary-color);
    color: white;
    border: 1px solid var(--primary-color);
}

/* Legacy brand color remapping for Tailwind arbitrary value utilities */
.text-\[\#232B3B\] { color: #892C8C !important; }
.bg-\[\#232B3B\] { background-color: #892C8C !important; }
.focus\:ring-\[\#232B3B\]:focus { --tw-ring-color: #892C8C !important; }

.text-\[\#F2A949\], .text-\[\#f2a949\] { color: #892C8C !important; }

.text-\[\#DDA74F\] { color: #F8A02A !important; }
.bg-\[\#DDA74F\] { background-color: #F8A02A !important; }
.bg-\[\#DDA74F1C\] { background-color: #F8A02A1C !important; }
.focus\:ring-\[\#DDA74F\]:focus { --tw-ring-color: #F8A02A !important; }

.hover\:bg-\[\#1a1f2a\]:hover { background-color: #6F216F !important; }

/* Login background helper */
.login-bg {
    background-image: url('../images/background.png'), url('../images/background.opng');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 70%; /* show full image smaller */
}

/* Login visual split helper */
.login-visual {
    background-image: url('../images/background.png'), url('../images/background.opng');
    background-repeat: no-repeat;
    background-size: 65%;
    background-position: center;
}

@media (max-width: 1024px) {
    .login-bg { background-size: 85%; }
    .login-visual { background-size: 80%; }
}

@media (max-width: 640px) {
    .login-bg { background-size: 110%; }
    .login-visual { background-size: 110%; }
}

/* Utility Classes */
.text-primary { color: var(--primary-color) !important; }
.text-secondary { color: var(--secondary-color) !important; }
.text-success { color: var(--success-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-info { color: var(--info-color) !important; }

.bg-primary { background-color: var(--primary-color) !important; }
.bg-secondary { background-color: var(--secondary-color) !important; }
.bg-accent { background-color: var(--accent-color) !important; }
.bg-success { background-color: var(--success-color) !important; }
.bg-warning { background-color: var(--warning-color) !important; }
.bg-danger { background-color: var(--danger-color) !important; }
.bg-info { background-color: var(--info-color) !important; }

/* Responsive Design */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }

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

    .mobile-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 40;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease-in-out;
    }

    .mobile-overlay.open {
        opacity: 1;
        visibility: visible;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

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

.slide-in {
    animation: slideIn 0.3s ease-in-out;
}

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

/* Loading States */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}