/**
 * Ahtimam E-Commerce Platform
 * Admin Dashboard Styles - Glassmorphism Design
 * Colors: Blue (#2196F3), White (#FFFFFF)
 */

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

:root {
    --primary-blue: #2196F3;
    --primary-blue-light: #64B5F6;
    --primary-blue-dark: #1976D2;
    --white: #FFFFFF;
    --light-gray: #F5F7FA;
    --gray: #9E9E9E;
    --dark-gray: #424242;
    --success: #4CAF50;
    --danger: #36c8f4;
    --warning: #FFC107;
    
    --glass-bg: rgba(255, 255, 255, 0.15);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Performance Optimizations */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Cairo', sans-serif;
    background: var(--primary-blue); /* أزرق ثابت بدون تدرج */
    background-attachment: fixed;
    color: var(--dark-gray);
    line-height: 1.6;
    direction: rtl;
    /* Performance improvements */
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    will-change: scroll-position;
}

/* Scrollbar على اليمين وشفاف - محسّن للأداء */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(33, 150, 243, 0.3);
    border-radius: 10px;
    will-change: background;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(33, 150, 243, 0.5);
}

/* Smooth scrolling optimization */
html {
    scroll-behavior: smooth;
}

/* Performance optimizations */
.sidebar,
.main-content,
.content-area {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Reduce motion for performance */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

.container {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Sidebar Styles */
.sidebar {
    width: 280px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-left: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 30px 20px;
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--white);
}

.logo i {
    font-size: 36px;
    color: var(--white);
}

.logo h2 {
    font-size: 28px;
    font-weight: 700;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
    overflow-y: auto;
}

.sidebar-nav ul {
    list-style: none;
}

.sidebar-nav li {
    margin: 5px 15px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--white);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.3s ease;
    font-size: 16px;
}

.sidebar-nav a:hover,
.sidebar-nav li.active a {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.sidebar-nav a i {
    font-size: 20px;
    width: 25px;
}

/* Submenu - مخفية افتراضياً */
.sidebar-nav li.has-submenu > a {
    position: relative;
}

.submenu-arrow {
    position: absolute;
    left: 15px;
    font-size: 12px;
    transition: transform 0.3s ease;
    margin-right: auto;
}

.sidebar-nav li.has-submenu.open > a .submenu-arrow {
    transform: rotate(180deg);
}

.sidebar-nav .submenu {
    display: none; /* مخفية افتراضياً */
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin-top: 5px;
    list-style: none;
    animation: slideDown 0.3s ease;
}

.sidebar-nav li.has-submenu.open .submenu {
    display: block; /* تظهر عند الضغط */
}

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

.sidebar-nav .submenu li {
    margin: 0;
}

.sidebar-nav .submenu li a {
    padding: 10px 20px 10px 50px;
    font-size: 14px;
    border-radius: 8px;
}

.sidebar-nav .submenu li a i {
    font-size: 14px;
    margin-left: 8px;
    width: 18px;
}

.sidebar-nav .submenu li a:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--glass-border);
}

.btn-logout {
    width: 100%;
    padding: 12px;
    background: rgba(244, 67, 54, 0.2);
    color: var(--white);
    border: 1px solid rgba(244, 67, 54, 0.5);
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: rgba(244, 67, 54, 0.4);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn-menu {
    background: none;
    border: none;
    color: var(--white);
    font-size: 24px;
    cursor: pointer;
    display: none;
}

.header h1 {
    color: var(--white);
    font-size: 24px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 25px;
    color: var(--white);
}

.notifications {
    position: relative;
    cursor: pointer;
    font-size: 24px;
}

.notifications .badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--primary-blue-dark);
    color: var(--white);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.admin-profile i {
    font-size: 32px;
}

/* Content Area */
.content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

/* Glass Cards */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--glass-shadow);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    color: var(--white);
}

.card-header h3 {
    font-size: 22px;
    font-weight: 600;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* حجم متساوي */
    gap: 25px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 25px;
    min-height: 120px; /* ارتفاع ثابت لجميع المربعات */
    box-shadow: var(--glass-shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    background: var(--glass-bg);
}

.stat-icon.blue {
    color: var(--primary-blue);
    background: rgba(33, 150, 243, 0.2);
}

.stat-icon.blue-light {
    color: var(--primary-blue-light);
    background: rgba(100, 181, 246, 0.2);
}

.stat-icon.green {
    color: var(--success);
    background: rgba(76, 175, 80, 0.2);
}

.stat-icon.orange {
    color: #FF9800;
    background: rgba(255, 152, 0, 0.2);
}

.stat-icon.purple {
    color: #9C27B0;
    background: rgba(156, 39, 176, 0.2);
}

.stat-icon.red {
    color: #F44336;
    background: rgba(244, 67, 54, 0.2);
}

.stat-icon.teal {
    color: #009688;
    background: rgba(0, 150, 136, 0.2);
}

.stat-info h4 {
    font-size: 32px;
    font-weight: 700;
    color: var(--white);
    margin-bottom: 5px;
}

.stat-info p {
    color: var(--white);
    opacity: 0.9;
    font-size: 16px;
}

/* Buttons */
.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.btn-primary:hover {
    background: var(--primary-blue-dark);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(33, 150, 243, 0.4);
}

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

.btn-secondary:hover {
    background: var(--primary-blue);
    transform: translateY(-2px);
}

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

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

.btn-block {
    width: 100%;
    justify-content: center;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
}

thead th {
    padding: 15px;
    text-align: right;
    color: var(--white);
    font-weight: 600;
    border-bottom: 2px solid var(--glass-border);
}

tbody tr {
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

tbody tr:hover {
    background: rgba(255, 255, 255, 0.1);
}

tbody td {
    padding: 15px;
    border-bottom: 1px solid var(--glass-border);
    color: var(--white);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex !important;
}

/* Force hide when not active */
.modal:not(.active) {
    display: none !important;
}

.modal-content {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 40px;
    max-width: 700px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.3);
}

.modal-content::-webkit-scrollbar {
    width: 8px;
}

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

.modal-content::-webkit-scrollbar-thumb {
    background: var(--primary-blue);
    border-radius: 10px;
}

.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--primary-blue-dark);
}

/* Tabs */
.tabs-container {
    margin-bottom: 20px;
}

.tabs-header {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 20px;
}

.tab-button {
    padding: 12px 30px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-bottom: 3px solid transparent;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 8px 8px 0 0;
}

.tab-button:hover {
    background: rgba(255, 255, 255, 0.15);
}

.tab-button.active {
    background: rgba(33, 150, 243, 0.3);
    border-bottom-color: var(--primary-blue);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* Login Card */
.login-card {
    max-width: 450px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header i {
    font-size: 60px;
    color: var(--white);
    margin-bottom: 15px;
}

.login-header h2 {
    font-size: 32px;
    color: var(--white);
    margin-bottom: 5px;
}

.login-header p {
    color: var(--white);
    opacity: 0.8;
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--white);
    font-weight: 600;
    font-size: 16px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    font-size: 16px;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-blue);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.2);
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

/* Error Message */
.error-message {
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid var(--danger);
    color: var(--white);
    padding: 12px;
    border-radius: 8px;
    margin-top: 15px;
}

/* Shake Animation */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-10px); }
    20%, 40%, 60%, 80% { transform: translateX(10px); }
}

.error-message.shake {
    animation: shake 0.5s;
}

/* Loading */
.loading {
    text-align: center;
    padding: 50px;
    color: var(--white);
}

.loading i {
    font-size: 48px;
    margin-bottom: 15px;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

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

.badge-warning {
    background: var(--warning);
    color: var(--dark-gray);
}

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

.badge-info {
    background: var(--primary-blue);
    color: var(--white);
}

/* أزرار الأيقونات للمناطق */
.btn-icon {
    padding: 6px 10px;
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
}

.btn-icon:hover {
    opacity: 0.85;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

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

.btn-icon i {
    font-size: 12px;
}

/* Responsive & Zoom Support */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        height: 100vh;
        transform: translateX(-100%);
        z-index: 999;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .btn-menu {
        display: block;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .header h1 {
        font-size: 18px;
    }
}

/* دعم التكبير/التصغير (Zoom Compatibility) */
* {
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* إصلاح عرض الجداول عند التكبير */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

table {
    min-width: 100%;
    table-layout: auto;
}

/* إصلاح النماذج عند التكبير */
.modal-content {
    max-width: 95vw !important;
    max-height: 95vh;
    overflow-y: auto;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* إصلاح الصور عند التكبير */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* إصلاح الأزرار عند التكبير */
.btn,
button {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* منع المحتوى من الخروج عن الشاشة */
.container,
.main-content {
    max-width: 100vw;
    overflow-x: hidden;
}

/* إصلاح Cards عند التكبير */
.card {
    max-width: 100%;
    overflow: hidden;
}

