/* متجر دارك - لوحة التحكم */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700&display=swap');

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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #64748b;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --dark: #1e293b;
    --light: #f8fafc;
    --white: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 40px rgba(0,0,0,0.1);
}

body {
    font-family: 'Cairo', sans-serif;
    background: #f1f5f9;
    color: var(--dark);
    direction: rtl;
    min-height: 100vh;
}

/* Login Page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
}

.login-box {
    background: var(--white);
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary);
}

.login-box .logo {
    text-align: center;
    margin-bottom: 20px;
}

.login-box .logo img {
    max-width: 120px;
}

/* Sidebar */
.sidebar {
    position: fixed;
    right: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: var(--dark);
    color: var(--white);
    z-index: 1000;
    overflow-y: auto;
    transition: all 0.3s;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 1.5rem;
    color: var(--primary);
}

.sidebar-menu {
    padding: 15px 0;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    transition: all 0.3s;
    border-right: 3px solid transparent;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(255,255,255,0.1);
    color: var(--white);
    border-right-color: var(--primary);
}

.sidebar-menu a i {
    width: 20px;
    text-align: center;
}

/* Main Content */
.main-content {
    margin-right: 260px;
    min-height: 100vh;
    padding: 20px;
}

/* Header */
.header {
    background: var(--white);
    padding: 15px 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Stats Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--white);
    padding: 25px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.primary { background: rgba(99, 102, 241, 0.1); color: var(--primary); }
.stat-icon.success { background: rgba(34, 197, 94, 0.1); color: var(--success); }
.stat-icon.warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.stat-icon.danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }

.stat-info h3 { font-size: 1.8rem; font-weight: 700; margin-bottom: 5px; }
.stat-info p { color: var(--secondary); font-size: 0.9rem; }

/* Form Elements */
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 500; color: var(--dark); }

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

textarea.form-control { min-height: 120px; resize: vertical; }

select.form-control { cursor: pointer; }

input[type="file"].form-control {
    padding: 10px;
    cursor: pointer;
    background: var(--light);
}

input[type="file"].form-control::-webkit-file-upload-button {
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 10px;
}

input[type="file"].form-control::-webkit-file-upload-button:hover {
    background: var(--primary-dark, #4f46e5);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: var(--white); }
.btn-warning { background: var(--warning); color: var(--white); }
.btn-danger { background: var(--danger); color: var(--white); }
.btn-secondary { background: var(--secondary); color: var(--white); }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--dark); }
.btn-outline:hover { background: var(--light); }
.btn-sm { padding: 8px 16px; font-size: 0.875rem; }
.btn-lg { padding: 16px 32px; font-size: 1.1rem; }
.btn-block { width: 100%; }

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

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

table th, table td {
    padding: 12px 15px;
    text-align: right;
    border-bottom: 1px solid var(--border);
}

table th {
    background: var(--light);
    font-weight: 600;
    color: var(--secondary);
    font-size: 0.9rem;
}

table tr:hover { background: var(--light); }

table img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.badge-success { background: rgba(34, 197, 94, 0.1); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); }
.badge-primary { background: rgba(99, 102, 241, 0.1); color: var(--primary); }
.badge-secondary { background: rgba(100, 116, 139, 0.1); color: var(--secondary); }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

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

.modal {
    background: var(--white);
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(-20px);
    transition: all 0.3s;
}

.modal-overlay.active .modal { transform: translateY(0); }

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 { font-size: 1.2rem; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--secondary); }
.modal-body { padding: 20px; }
.modal-footer { padding: 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* Alerts */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success { background: rgba(34, 197, 94, 0.1); color: var(--success); border: 1px solid var(--success); }
.alert-danger { background: rgba(239, 68, 68, 0.1); color: var(--danger); border: 1px solid var(--danger); }
.alert-warning { background: rgba(245, 158, 11, 0.1); color: var(--warning); border: 1px solid var(--warning); }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
}

.pagination a, .pagination span {
    padding: 8px 15px;
    border: 1px solid var(--border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--dark);
    transition: all 0.3s;
}

.pagination a:hover, .pagination .active { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* Search & Filters */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--light);
    border-radius: 8px;
}

.filters .form-control { width: auto; min-width: 200px; padding: 10px 15px; }

/* Grid */
.row { display: flex; flex-wrap: wrap; margin: -10px; }
.col { padding: 10px; }
.col-6 { width: 50%; }
.col-4 { width: 33.333%; }
.col-3 { width: 25%; }
.col-12 { width: 100%; }

/* Utilities */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.d-flex { display: flex; }
.gap-1 { gap: 10px; }
.gap-2 { gap: 20px; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }

/* Image Upload */
.image-upload {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.image-upload:hover { border-color: var(--primary); background: rgba(99, 102, 241, 0.05); }
.image-upload input { display: none; }
.image-upload i { font-size: 3rem; color: var(--secondary); margin-bottom: 10px; }
.image-preview { max-width: 200px; margin-top: 15px; border-radius: 8px; }

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Chart Container */
.chart-container { position: relative; height: 300px; }

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 3000;
}

.toast {
    background: var(--white);
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn { from { transform: translateX(-100%); opacity: 0; } }

/* Responsive */
@media (max-width: 992px) {
    .sidebar { width: 0; overflow: hidden; }
    .sidebar.active { width: 260px; }
    .main-content { margin-right: 0; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: 1fr; }
    .col-6, .col-4, .col-3 { width: 100%; }
    .filters { flex-direction: column; }
    .filters .form-control { width: 100%; }
}

/* Messages & Chat Styles */
.messages-container {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
    height: calc(100vh - 150px);
}

.conversations-panel {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.conversations-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    background: var(--primary);
    color: var(--white);
}

.conversations-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.conversations-list {
    flex: 1;
    overflow-y: auto;
}

.conversation-item {
    display: flex;
    gap: 12px;
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    background: white;
}

.conversation-item:hover {
    background: #f8f9fa;
}

.conversation-item.active {
    background: #e3f2fd;
    border-left: 4px solid #075E54;
}

.conversation-avatar {
    font-size: 2.8rem;
    color: #075E54;
    line-height: 1;
    display: flex;
    align-items: center;
}

.conversation-info {
    flex: 1;
    min-width: 0;
}

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.conversation-header h4 {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 600;
    color: #1a1a1a;
}

.conversation-preview {
    margin: 4px 0;
    font-size: 0.85rem;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 6px;
}

.conversation-preview i {
    font-size: 0.75rem;
    opacity: 0.7;
}

.conversation-time {
    font-size: 0.7rem;
    color: #999;
    margin-top: 2px;
    display: block;
}

.chat-panel {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    background: #075E54;
    color: var(--white);
}

.chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #ECE5DD;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.message {
    display: flex;
    margin-bottom: 10px;
}

.message-sent {
    justify-content: flex-end;
}

.message-received {
    justify-content: flex-start;
}

.message-content {
    max-width: 65%;
    padding: 10px 14px;
    border-radius: 8px;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.message-sent .message-content {
    background: #DCF8C6;
    border-bottom-left-radius: 2px;
}

.message-received .message-content {
    background: white;
    border-bottom-right-radius: 2px;
}

.message-content p {
    margin: 0 0 4px 0;
    line-height: 1.5;
    font-size: 0.95rem;
    color: #1a1a1a;
}

.message-content small {
    font-size: 0.7rem;
    color: #888;
    display: block;
    text-align: left;
}

.chat-input {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    background: var(--white);
    align-items: center;
}

.chat-input .btn-icon {
    background: transparent;
    border: none;
    color: #666;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 8px;
    transition: all 0.2s;
}

.chat-input .btn-icon:hover {
    color: var(--primary);
    transform: scale(1.1);
}

.chat-input input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: 25px;
    font-size: 0.95rem;
    outline: none;
}

.chat-input input:focus {
    border-color: var(--primary);
}

.chat-input button.btn-primary {
    border-radius: 25px;
    padding: 12px 25px;
}


/* Message types */
.message-image img {
    max-width: 300px;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
    display: block;
    margin-bottom: 5px;
}

.message-audio audio {
    width: 250px;
    height: 40px;
}

.message-file {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
}

.message-file i {
    font-size: 2rem;
    color: var(--primary);
}

.message-file strong {
    display: block;
    font-size: 0.9rem;
}

.message-file small {
    display: block;
    color: #999;
    font-size: 0.75rem;
}

.message-location {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: rgba(0,0,0,0.05);
    border-radius: 8px;
}

.message-location i {
    font-size: 2rem;
    color: #e74c3c;
}

.message-location a {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.85rem;
}

/* Reply preview */
.message-reply-preview {
    display: flex;
    gap: 8px;
    padding: 8px;
    margin-bottom: 8px;
    background: rgba(0,0,0,0.1);
    border-radius: 6px;
    font-size: 0.85rem;
}

.reply-line {
    width: 3px;
    background: var(--primary);
    border-radius: 2px;
}

.message-reply-preview strong {
    display: block;
    color: var(--primary);
    font-size: 0.8rem;
    margin-bottom: 2px;
}

.message-reply-preview p {
    margin: 0;
    color: #666;
    font-size: 0.8rem;
}

/* Reaction */
.message-reaction {
    position: absolute;
    bottom: -8px;
    left: 10px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Message actions */
.message {
    position: relative;
}

.message-actions {
    position: absolute;
    top: 5px;
    left: -80px;
    display: none;
    gap: 5px;
    background: white;
    padding: 5px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.message:hover .message-actions {
    display: flex;
}

.message-actions button {
    background: transparent;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: all 0.2s;
}

.message-actions button:hover {
    background: #f0f0f0;
    color: var(--primary);
}

/* Deleted message */
.message-deleted {
    opacity: 0.6;
    font-style: italic;
    background: #f5f5f5 !important;
}

.message-deleted i {
    margin-left: 5px;
}

.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

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

@media (max-width: 992px) {
    .messages-container {
        grid-template-columns: 1fr;
    }

    .conversations-panel {
        display: none;
    }
}
