@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;600;700;800&display=swap');

:root {
    /* WhatsApp API theme */
    --wa-green: #25D366;
    --wa-green-hover: #20BD5A;
    --wa-teal: #128C7E;
    --wa-teal-dark: #075E54;
    --primary-gradient: linear-gradient(135deg, #0a1628 0%, #075E54 50%, #0d2d2a 100%);
    --secondary-gradient: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    --accent-gradient: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    --accent-gradient-hover: linear-gradient(135deg, #20BD5A 0%, #0f7a6e 100%);
    --gold-gradient: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    --dark-gradient: linear-gradient(135deg, #075E54 0%, #0a1628 100%);
    --red-gradient: linear-gradient(135deg, #25D366, #128C7E);
    --red-gradient-hover: linear-gradient(135deg, #20BD5A, #0f7a6e);
}

body {
    font-family: 'Tajawal', sans-serif;
    background: var(--primary-gradient);
    background-attachment: fixed;
    min-height: 100vh;
}

/* Enhanced Glass morphism effects */
.glass {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: all 0.3s ease;
}

.glass:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.2);
}

.glass-dark {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

.glass-dark:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.glass-light {
    background: rgba(31, 41, 55, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.glass-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.glass-input:focus {
    outline: none;
    border-color: rgba(37, 211, 102, 0.5);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.15);
    background: rgba(255, 255, 255, 0.08);
}

/* Ensure select dropdowns are readable */
select.glass-input {
    color: #ffffff;
    background-color: rgba(31, 41, 55, 0.9);
}

select.glass-input option, select.glass-input optgroup {
    color: #ffffff;
    background-color: #111827; /* bg-gray-900 */
}

/* Fallback for browsers that ignore option background */
select.glass-input:focus option {
    color: #ffffff;
}

/* Animated background particles */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(37, 211, 102, 0.4);
    border-radius: 50%;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); opacity: 0.4; }
    50% { transform: translateY(-20px) rotate(180deg); opacity: 0.8; }
}

/* Enhanced hover animations */
.hover-lift {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-lift:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(37, 211, 102, 0.2);
}

/* Mobile sidebar animation */
#mobileSidebar {
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(100%);
}

#mobileSidebar.open {
    transform: translateX(0);
}

/* Mobile sidebar overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 39;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Desktop sidebar collapsed (icons only) - more space for content */
@media (min-width: 768px) {
    body.sidebar-collapsed #desktopSidebar {
        width: 5rem;
    }
    body.sidebar-collapsed #desktopSidebar .sidebar-header-text,
    body.sidebar-collapsed #desktopSidebar .sidebar-nav-label,
    body.sidebar-collapsed #desktopSidebar .sidebar-section {
        display: none !important;
    }
    body.sidebar-collapsed #desktopSidebar .p-8 {
        padding: 1rem;
    }
    body.sidebar-collapsed #desktopSidebar .sidebar-header-inner {
        justify-content: center;
    }
    body.sidebar-collapsed #desktopSidebar .sidebar-header-brand {
        display: none;
    }
    body.sidebar-collapsed #mainContent {
        margin-right: 5rem !important;
    }
    body.sidebar-collapsed #desktopSidebar nav {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    body.sidebar-collapsed #desktopSidebar nav a {
        justify-content: center;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    body.sidebar-collapsed #desktopSidebar nav a > div:first-child {
        margin-left: 0;
        flex-shrink: 0;
        width: 2.5rem;
        height: 2.5rem;
        min-width: 2.5rem;
        min-height: 2.5rem;
    }
    body.sidebar-collapsed #desktopSidebar nav a > div:first-child svg,
    body.sidebar-collapsed #desktopSidebar nav a > div:first-child .material-symbols-rounded,
    body.sidebar-collapsed #desktopSidebar nav a > div:first-child span[aria-hidden] {
        width: 1.25rem !important;
        height: 1.25rem !important;
        min-width: 1.25rem;
        min-height: 1.25rem;
        font-size: 1.25rem !important;
    }
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--accent-gradient);
    border-radius: 10px;
    transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-gradient-hover);
}

/* Enhanced gradient text - WhatsApp green */
.gradient-text {
    background: linear-gradient(135deg, #25D366, #128C7E);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 600;
}

/* Logo spinning animation */
.logo-spin {
    animation: spin 20s linear infinite;
}

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

/* Enhanced pulse animation */
.pulse-glow {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(37, 211, 102, 0.15);
        transform: scale(1.02);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
        transform: scale(1);
    }
}

/* Mobile menu open state */
body.mobile-menu-open {
    overflow: hidden;
}

/* Enhanced button styles - WhatsApp green */
.btn-primary {
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: white;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #20BD5A, #0f7a6e);
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(37, 211, 102, 0.4);
    color: white;
}

.btn-primary:active {
    transform: translateY(0);
}

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

.btn-primary:hover::before {
    left: 100%;
}

/* Table hover effects */
.table-row {
    transition: all 0.3s ease;
}

.table-row:hover {
    background: rgba(37, 211, 102, 0.1);
    transform: scale(1.01);
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.15);
}

/* Form sections */
.form-section {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.form-section:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.form-section h2 {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 1rem;
    color: #ffffff;
    background: linear-gradient(135deg, #25D366, #128C7E);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.form-group {
    margin-bottom: 1rem;
}

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

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    outline: none;
    border-color: rgba(37, 211, 102, 0.5);
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.15);
    background: rgba(255, 255, 255, 0.08);
}

.form-group input[type="file"] {
    padding: 0.5rem;
}

/* Enhanced DataTables styling */
.dataTables_wrapper {
    font-family: 'Tajawal', sans-serif;
    color: #ffffff;
    direction: rtl;
    padding: 1rem;
    position: relative;
}

/* DataTable Header Controls */
.dataTables_wrapper .dataTables_top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* DataTable Footer Controls */
.dataTables_wrapper .dataTables_bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(10px);
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Positioning for length and filter */
.dataTables_wrapper .dataTables_length {
    margin: 0;
}

.dataTables_wrapper .dataTables_filter {
    margin: 0;
}

/* Info positioning */
.dataTables_wrapper .dataTables_info {
    margin: 0;
    color: #e5e7eb;
    font-size: 0.875rem;
}

/* Pagination positioning */
.dataTables_wrapper .dataTables_paginate {
    margin: 0;
}

/* Input and Select Styling */
.dataTables_length select,
.dataTables_filter input {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

.dataTables_length select:focus,
.dataTables_filter input:focus {
    outline: none;
    border-color: rgba(37, 211, 102, 0.5);
    box-shadow: 0 0 10px rgba(37, 211, 102, 0.2);
    background: rgba(255, 255, 255, 0.12);
}

.dataTables_length label,
.dataTables_filter label {
    color: #e5e7eb;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Search input specific styling */
.dataTables_filter input {
    width: 300px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='rgba(255,255,255,0.5)' viewBox='0 0 24 24' width='16' height='16'%3E%3Cpath d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

/* Select dropdown styling */
.dataTables_length select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='rgba(255,255,255,0.7)' viewBox='0 0 24 24' width='16'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 0.75rem center;
    padding-left: 2.5rem;
    min-width: 80px;
}

/* Enhanced Pagination */
.dataTables_paginate {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.dataTables_paginate .paginate_button {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #ffffff !important;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    min-width: 2.5rem;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
}

.dataTables_paginate .paginate_button:hover:not(.disabled):not(.current) {
    background: rgba(37, 211, 102, 0.15);
    border-color: rgba(37, 211, 102, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.2);
}

.dataTables_paginate .paginate_button.current {
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: #ffffff !important;
    border-color: transparent;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
    transform: scale(1.05);
}

.dataTables_paginate .paginate_button.disabled {
    opacity: 0.3;
    cursor: not-allowed;
    color: #6b7280 !important;
    background: rgba(255, 255, 255, 0.03);
}

.dataTables_paginate .paginate_button.disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Navigation buttons (Previous/Next) */
.dataTables_paginate .paginate_button.previous,
.dataTables_paginate .paginate_button.next {
    background: rgba(37, 211, 102, 0.1);
    border-color: rgba(37, 211, 102, 0.2);
    font-weight: 600;
}

.dataTables_paginate .paginate_button.previous:hover:not(.disabled),
.dataTables_paginate .paginate_button.next:hover:not(.disabled) {
    background: rgba(37, 211, 102, 0.2);
    border-color: rgba(37, 211, 102, 0.4);
}

/* RTL Support and Additional Styling */
.dataTables_length,
.dataTables_filter {
    text-align: right;
}

.dataTables_filter input {
    width: 300px;
}

/* Table container styling */
.dataTables_scroll {
    margin: 1rem 0;
}

#productsTable {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(5px);
    border-radius: 0.75rem;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

#productsTable th,
#productsTable td {
    border-color: rgba(255, 255, 255, 0.08);
    padding: 1rem;
    transition: all 0.3s ease;
    vertical-align: middle;
}

#productsTable thead th {
    background: rgba(37, 211, 102, 0.1);
    backdrop-filter: blur(5px);
    font-weight: 600;
    color: #ffffff;
    border-bottom: 2px solid rgba(37, 211, 102, 0.2);
    text-align: center;
}

#productsTable tbody tr {
    transition: all 0.3s ease;
}

#productsTable tbody tr:hover {
    background: rgba(37, 211, 102, 0.05);
    transform: scale(1.005);
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.1);
}

#productsTable tbody tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.02);
}

#productsTable tbody tr:nth-child(even):hover {
    background: rgba(37, 211, 102, 0.05);
}

/* Mobile responsiveness for DataTable controls */
@media (max-width: 768px) {
    .dataTables_wrapper .dataTables_top,
    .dataTables_wrapper .dataTables_bottom {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .dataTables_filter input {
        width: 100%;
    }

    .dataTables_paginate {
        justify-content: center;
        flex-wrap: wrap;
    }

    .dataTables_length label,
    .dataTables_filter label {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
}

/* Action buttons in table */
.table-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
}

.table-actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
}

.table-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Enhanced toggle switches */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(55, 65, 81, 0.8);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 26px;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 2px;
    background: linear-gradient(45deg, #ffffff, #f0f0f0);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

input:checked + .toggle-slider {
    background: linear-gradient(135deg, #25D366, #128C7E);
    border-color: rgba(37, 211, 102, 0.3);
}

input:checked + .toggle-slider:before {
    transform: translateX(22px);
    background: linear-gradient(45deg, #ffffff, #dcf8c6);
}

.toggle-slider:hover {
    box-shadow: 0 0 10px rgba(37, 211, 102, 0.2);
}

/* Enhanced utility classes */
.shadow-glow {
    box-shadow: 0 0 20px rgba(37, 211, 102, 0.3);
}

.border-accent {
    border-color: rgba(37, 211, 102, 0.3);
}

.text-accent {
    color: #25D366;
}

.bg-accent {
    background: var(--accent-gradient);
}

/* Smooth transitions for all interactive elements */
* {
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;
    transition-duration: 0.3s;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Focus styles for accessibility */
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgba(37, 211, 102, 0.5);
    outline-offset: 2px;
}

/* Loading animation */
@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: calc(200px + 100%) 0; }
}

.loading-shimmer {
    background: linear-gradient(90deg, transparent, rgba(37, 211, 102, 0.1), transparent);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
}