/* ==========================================
   SAWZA - Dark Theme & Magical Effects
   ========================================== */

:root {
    --primary-color: #6366f1;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #3b82f6;
    
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --bg-card: #1e293b;
    --bg-hover: #334155;
    
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.4);

    --sidebar-width: 280px;
    --sidebar-collapsed-width: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Naskh Arabic', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-darker) 0%, var(--bg-dark) 100%);
    color: var(--text-primary);
    min-height: 100vh;
    direction: rtl;
    line-height: 1.6;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-darker);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* ==========================================
   SIDEBAR
   ========================================== */

.sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-darker) 100%);
    border-left: 2px solid var(--primary-color);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

.sidebar.collapsed .sidebar-brand span,
.sidebar.collapsed .sidebar-item span,
.sidebar.collapsed .sidebar-section-title {
    opacity: 0;
    width: 0;
    display: none;
}

.sidebar.collapsed .sidebar-footer {
    display: none;
}

/* Sidebar Header */
.sidebar-header {
    padding: 1.5rem;
    border-bottom: 2px solid var(--primary-color);
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.sidebar-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 70%
    );
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 1.8rem;
    font-weight: bold;
    color: white;
    text-decoration: none;
    position: relative;
    z-index: 1;
    animation: float 3s ease-in-out infinite;
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-brand {
    justify-content: center;
    gap: 0;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

.sidebar-brand i {
    font-size: 2rem;
}

/* Sidebar Menu */
.sidebar-menu {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    color: var(--text-primary);
    text-decoration: none;
    transition: all 0.3s ease;
    border-right: 4px solid transparent;
    font-size: 1.05rem;
    position: relative;
    white-space: nowrap;
}

.sidebar.collapsed .sidebar-item {
    justify-content: center;
    padding: 1rem 0.5rem;
}

.sidebar.collapsed .sidebar-item[title]:hover::after {
    content: attr(title);
    position: absolute;
    left: 70px;
    background: var(--bg-card);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    white-space: nowrap;
    z-index: 1000;
    border: 1px solid var(--primary-color);
    font-size: 0.95rem;
    pointer-events: none;
    animation: tooltipFadeIn 0.2s ease;
}

@keyframes tooltipFadeIn {
    from {
        opacity: 0;
        transform: translateX(5px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.sidebar-item i {
    font-size: 1.3rem;
    min-width: 30px;
    width: 30px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar.collapsed .sidebar-item i {
    margin: 0;
}

.sidebar-item span {
    flex: 1;
}

.sidebar-item:hover {
    background: linear-gradient(90deg, transparent 0%, rgba(99, 102, 241, 0.2) 100%);
    border-right-color: var(--primary-color);
    color: white;
    transform: translateX(-3px);
    box-shadow: inset 4px 0 0 var(--primary-color);
}

.sidebar.collapsed .sidebar-item:hover {
    transform: translateX(0);
    background: rgba(99, 102, 241, 0.3);
}

.sidebar-item.active {
    background: linear-gradient(90deg, transparent 0%, rgba(99, 102, 241, 0.3) 100%);
    border-right-color: var(--success-color);
    color: white;
    font-weight: 600;
}

.sidebar.collapsed .sidebar-item.active {
    background: rgba(99, 102, 241, 0.4);
}

/* Sidebar Sections */
.sidebar-section {
    margin: 0.5rem 0;
}

.sidebar-section-title {
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.sidebar-section-title i {
    font-size: 1.2rem;
    min-width: 30px;
    width: 30px;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar.collapsed .sidebar-section-title {
    justify-content: center;
    padding: 0.75rem 0.5rem;
}

.sidebar.collapsed .sidebar-section-title i {
    margin: 0;
}

.sidebar-sub-item {
    padding-right: 3.5rem !important;
    font-size: 0.95rem;
    border-right-width: 3px;
}

.sidebar-sub-item i {
    font-size: 1.2rem !important;
    min-width: 30px;
    width: 30px;
}

.sidebar.collapsed .sidebar-sub-item {
    padding-right: 0.5rem !important;
    padding-left: 0.5rem;
}

.sidebar-sub-item:hover {
    padding-right: 3.2rem !important;
}

.sidebar.collapsed .sidebar-sub-item:hover {
    padding-right: 0.5rem !important;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--bg-darker);
}

.sidebar-user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem;
}

.sidebar.collapsed .sidebar-user-info {
    flex-direction: column;
    gap: 0.5rem;
}

.user-avatar {
    font-size: 3rem;
    color: var(--primary-color);
    animation: float 3s ease-in-out infinite;
}

.sidebar.collapsed .user-avatar {
    font-size: 2rem;
}

.user-details {
    flex: 1;
}

.sidebar.collapsed .user-details {
    display: none;
}

.user-name {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.sidebar-auth-links {
    padding: 0.5rem;
}

.sidebar.collapsed .sidebar-auth-links {
    display: none;
}

/* Sidebar Toggle Button */
.sidebar-toggle {
    position: fixed;
    right: 1rem;
    top: 1rem;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    z-index: 1001;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-toggle:hover {
    transform: scale(1.1) rotate(90deg);
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.8);
}

/* Main Content */
.main-content {
    margin-right: var(--sidebar-width);
    padding: 2rem;
    min-height: 100vh;
    transition: all 0.3s ease;
}

.sidebar.collapsed ~ .main-content {
    margin-right: var(--sidebar-collapsed-width);
}

/* Fix container-fluid */
.container-fluid {
    padding: 0 !important;
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay {
        display: block;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        margin-right: 0;
    }

    .sidebar.collapsed ~ .main-content {
        margin-right: 0;
    }
}

/* ==========================================
   Header & Navigation (Removed - Using Sidebar Now)
   ========================================== */

/* ==========================================
   Cards & Containers
   ========================================== */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.card-header {
    background: linear-gradient(135deg, var(--bg-hover) 0%, var(--bg-card) 100%);
    border-bottom: 2px solid var(--primary-color);
    padding: 1rem 1.5rem;
    font-weight: bold;
    font-size: 1.2rem;
}

.card-body {
    padding: 1.5rem;
}

/* Color Variants */
.card-info {
    border-color: var(--info-color);
}

.card-success {
    border-color: var(--success-color);
}

.card-warning {
    border-color: var(--warning-color);
}

.card-danger {
    border-color: var(--danger-color);
}

/* ==========================================
   Buttons
   ========================================== */

.btn {
    border-radius: 8px;
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    border: none;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}

.btn-primary:hover {
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.8);
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.5);
}

.btn-success:hover {
    box-shadow: 0 0 25px rgba(16, 185, 129, 0.8);
    transform: translateY(-2px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

.btn-danger:hover {
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.8);
    transform: translateY(-2px);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
    color: white;
    box-shadow: 0 0 15px rgba(245, 158, 11, 0.5);
}

.btn-warning:hover {
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.8);
    transform: translateY(-2px);
}

.btn-info {
    background: linear-gradient(135deg, var(--info-color) 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

.btn-info:hover {
    box-shadow: 0 0 25px rgba(59, 130, 246, 0.8);
    transform: translateY(-2px);
}

/* ==========================================
   Forms & Inputs
   ========================================== */

.form-control, .form-select {
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.7rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    background: var(--bg-card);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.25);
    transform: translateY(-2px);
    color: var(--text-primary);
}

.form-label {
    color: var(--text-secondary);
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-label i {
    animation: float 2s ease-in-out infinite;
}

/* Input Groups */
.input-group {
    box-shadow: var(--shadow-sm);
    border-radius: 8px;
}

.input-group-text {
    background: var(--bg-hover);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

/* ==========================================
   Tables
   ========================================== */

.table {
    color: var(--text-primary);
    border-radius: 8px;
    overflow: hidden;
}

.table thead {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.table thead th {
    border: none;
    padding: 1rem;
    font-weight: 600;
    text-align: center;
}

.table tbody tr {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.table tbody tr:hover {
    background: var(--bg-hover);
    transform: scale(1.01);
}

.table tbody td {
    padding: 1rem;
    vertical-align: middle;
    text-align: center;
}

/* ==========================================
   Product Cards (for POS)
   ========================================== */

.product-card {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.product-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, transparent 0%, rgba(99, 102, 241, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.product-card:hover::before {
    opacity: 1;
}

.product-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
    box-shadow: var(--shadow-glow);
}

.product-card img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.product-card h5 {
    margin: 0.5rem 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* Small Product Cards (for Products Management) */
.product-card-small {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s ease;
    overflow: hidden;
    height: 100%;
}

.product-card-small:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.product-card-small img {
    border-radius: 4px;
}

.product-card-small h6 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0;
}

.badge-sm {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
}

.btn-xs {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* ==========================================
   Badges & Labels
   ========================================== */

.badge {
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}

/* ==========================================
   Alerts
   ========================================== */

.alert {
    border-radius: 8px;
    border: none;
    padding: 1rem 1.5rem;
    box-shadow: var(--shadow-md);
}

.alert-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #059669 100%);
    color: white;
}

.alert-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #dc2626 100%);
    color: white;
}

.alert-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #d97706 100%);
    color: white;
}

.alert-info {
    background: linear-gradient(135deg, var(--info-color) 0%, #2563eb 100%);
    color: white;
}

/* ==========================================
   Modal
   ========================================== */

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 2px solid var(--primary-color);
    background: linear-gradient(135deg, var(--bg-hover) 0%, var(--bg-card) 100%);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
}

.modal-title {
    color: var(--text-primary);
}

.btn-close {
    filter: invert(1);
}

/* ==========================================
   Utilities
   ========================================== */

.cart-item {
    background: linear-gradient(135deg, var(--bg-hover) 0%, var(--bg-card) 100%);
    border-radius: 10px;
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    border-right: 4px solid var(--primary-color);
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.cart-item:hover {
    transform: translateX(-3px);
    box-shadow: var(--shadow-md);
    border-right-color: var(--success-color);
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glow {
    animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 10px rgba(99, 102, 241, 0.5); }
    50% { box-shadow: 0 0 25px rgba(99, 102, 241, 0.8); }
}

/* ==========================================
   Responsive
   ========================================== */

@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }
    
    .product-card img {
        height: 120px;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}
