/* 
   Drips Admin Panel Styles
   Theme: Dark with Gold Accents
*/

@import url('tags-input.css');

:root {
    /* Colors - Dark Theme */
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-card: #252525;
    --bg-hover: #2a2a2a;
    
    /* Gold Accent */
    --gold-primary: #C9A86C;
    --gold-light: #DFCA9E;
    --gold-dark: #A68B4E;
    
    /* Text Colors */
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-muted: #666666;
    
    /* Status Colors */
    --success: #4CAF50;
    --error: #ff4d4d;
    --warning: #ff9800;
    
    /* Spacing */
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 20px;
    --spacing-lg: 32px;
    --spacing-xl: 48px;
    
    /* Border Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 50px;
    
    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 20px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.5);
    
    /* Font */
    --font-main: 'Cairo', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    direction: rtl;
}

.hidden {
    display: none !important;
}

/* =====================================
   Login Screen
   ===================================== */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1a1510 100%);
}

.login-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(201, 168, 108, 0.1);
}

.login-logo {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.logo-text {
    font-size: 3rem;
    font-weight: 700;
    color: var(--gold-primary);
    display: block;
}

.logo-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: var(--spacing-xs);
    display: block;
}

/* =====================================
   Form Elements
   ===================================== */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-xs);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--bg-secondary);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-main);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--gold-primary);
    box-shadow: 0 0 0 3px rgba(201, 168, 108, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: var(--spacing-md);
}

/* =====================================
   Buttons
   ===================================== */
.btn-primary {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background: linear-gradient(135deg, var(--gold-primary), var(--gold-dark));
    color: var(--bg-primary);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--gold-light), var(--gold-primary));
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(201, 168, 108, 0.3);
}

.btn-add {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    background: var(--gold-primary);
    color: var(--bg-primary);
    border: none;
    border-radius: var(--radius-full);
    font-family: var(--font-main);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-add:hover {
    background: var(--gold-light);
    transform: scale(1.05);
}

.btn-add span {
    font-size: 1.2rem;
    font-weight: 700;
}

.btn-logout {
    padding: var(--spacing-xs) var(--spacing-md);
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--text-muted);
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    color: var(--error);
    border-color: var(--error);
}

/* =====================================
   Admin Header
   ===================================== */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.header-brand .logo-text {
    font-size: 1.8rem;
}

.header-title {
    color: var(--text-secondary);
    font-size: 1rem;
    padding-right: var(--spacing-md);
    border-right: 1px solid var(--text-muted);
}

/* =====================================
   Navigation Tabs
   ===================================== */
.admin-nav {
    display: flex;
    gap: var(--spacing-xs);
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-secondary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-tab.active {
    background: var(--gold-primary);
    color: var(--bg-primary);
}

.tab-icon {
    font-size: 1.2rem;
}

/* =====================================
   Content Area
   ===================================== */
.admin-content {
    padding: var(--spacing-lg);
    max-width: 1400px;
    margin: 0 auto;
}

.content-section {
    display: none;
}

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

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

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

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

.section-header-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

/* Back Button */
.btn-back {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-md);
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--text-muted);
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-back:hover {
    color: var(--gold-primary);
    border-color: var(--gold-primary);
}

.btn-back span {
    font-size: 1.1rem;
}

/* Clickable Category Card */
.item-card.clickable {
    cursor: pointer;
}

.item-card.clickable .item-image-container {
    position: relative;
}

.item-card.clickable:hover .view-products-overlay {
    opacity: 1;
}

.view-products-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(201, 168, 108, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.view-products-overlay span {
    color: var(--bg-primary);
    font-weight: 600;
    font-size: 1rem;
}

/* Products count badge */
.products-count {
    display: inline-block;
    background: var(--gold-primary);
    color: var(--bg-primary);
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 600;
    margin-right: var(--spacing-xs);
}


/* =====================================
   Items Grid
   ===================================== */
.items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--spacing-md);
}

.item-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.item-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    border-color: rgba(201, 168, 108, 0.2);
}

.item-image {
    width: 100%;
    height: 180px;
    object-fit: cover;
    background: var(--bg-secondary);
}

.item-info {
    padding: var(--spacing-md);
}

.item-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    color: var(--text-primary);
}

.item-price {
    color: var(--gold-primary);
    font-weight: 700;
    font-size: 1rem;
}

.item-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: var(--spacing-xs);
    line-height: 1.5;
}

.item-actions {
    display: flex;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm) var(--spacing-md);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-edit,
.btn-delete-item {
    flex: 1;
    padding: var(--spacing-xs);
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-edit {
    background: rgba(201, 168, 108, 0.1);
    color: var(--gold-primary);
}

.btn-edit:hover {
    background: rgba(201, 168, 108, 0.2);
}

.btn-delete-item {
    background: rgba(255, 77, 77, 0.1);
    color: var(--error);
}

.btn-delete-item:hover {
    background: rgba(255, 77, 77, 0.2);
}

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

.modal.active {
    display: flex;
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from { 
        opacity: 0;
    }
    to { 
        opacity: 1;
    }
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

.modal-large {
    max-width: 600px;
}

.modal-small {
    max-width: 400px;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.modal-header h3 {
    color: var(--gold-primary);
    font-size: 1.2rem;
}

.modal-close {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal form {
    padding: var(--spacing-md);
}

.modal-actions {
    display: flex;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-md);
}

.btn-cancel {
    flex: 1;
    padding: var(--spacing-sm);
    background: transparent;
    border: 1px solid var(--text-muted);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-main);
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-cancel:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.btn-save {
    flex: 1;
    padding: var(--spacing-sm);
    background: var(--gold-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--bg-primary);
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-save:hover {
    background: var(--gold-light);
}

/* Custom Checkbox */
.checkbox-group {
    margin-top: var(--spacing-md);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-custom {
    width: 22px;
    height: 22px;
    border: 2px solid var(--text-muted);
    border-radius: 4px;
    position: relative;
    transition: all 0.3s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom {
    background: var(--gold-primary);
    border-color: var(--gold-primary);
}

.checkbox-label input[type="checkbox"]:checked + .checkbox-custom::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--bg-primary);
    font-size: 14px;
    font-weight: bold;
}

.checkbox-label span:last-child {
    color: var(--text-secondary);
    font-size: 0.95rem;
}


.btn-delete {
    flex: 1;
    padding: var(--spacing-sm);
    background: var(--error);
    border: none;
    border-radius: var(--radius-sm);
    color: white;
    font-family: var(--font-main);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-delete:hover {
    background: #ff6666;
}

.delete-message {
    padding: var(--spacing-md);
    text-align: center;
    color: var(--text-secondary);
}

/* =====================================
   Image Upload
   ===================================== */
.image-upload-area {
    position: relative;
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    padding: var(--spacing-lg);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.image-upload-area:hover {
    border-color: var(--gold-primary);
    background: rgba(201, 168, 108, 0.05);
}

.image-upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-sm);
    color: var(--text-secondary);
}

.upload-icon {
    font-size: 2rem;
}

.image-preview {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

/* =====================================
   Toast Notifications
   ===================================== */
#toast-container {
    position: fixed;
    bottom: var(--spacing-lg);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.toast {
    padding: var(--spacing-sm) var(--spacing-lg);
    border-radius: var(--radius-full);
    font-size: 0.95rem;
    animation: toastIn 0.3s ease;
    box-shadow: var(--shadow-md);
}

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

.toast.error {
    background: var(--error);
    color: white;
}

.toast.warning {
    background: var(--warning);
    color: black;
}

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

/* =====================================
   Loading Spinner
   ===================================== */
.loading-spinner {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-secondary);
}

/* =====================================
   Empty State
   ===================================== */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

/* =====================================
   Responsive
   ===================================== */
@media (max-width: 768px) {
    .admin-header {
        padding: var(--spacing-sm) var(--spacing-md);
    }
    
    .header-brand .logo-text {
        font-size: 1.4rem;
    }
    
    .header-title {
        display: none;
    }
    
    .admin-nav {
        padding: var(--spacing-sm);
    }
    
    .nav-tab {
        padding: var(--spacing-sm);
    }
    
    .tab-text {
        display: none;
    }
    
    .admin-content {
        padding: var(--spacing-md);
    }
    
    .section-header {
        flex-direction: column;
        gap: var(--spacing-md);
        align-items: stretch;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .items-grid {
        grid-template-columns: 1fr;
    }
}

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--gold-dark);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gold-primary);
}

/* =====================================
   Popular Toggle Button
   ===================================== */
.btn-popular-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    width: 100%;
    padding: var(--spacing-md);
    background: var(--bg-secondary);
    border: 2px solid var(--text-muted);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-family: var(--font-main);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-popular-toggle:hover {
    border-color: var(--gold-primary);
    color: var(--gold-primary);
}

.btn-popular-toggle.active {
    background: linear-gradient(135deg, var(--gold-primary), var(--gold-dark));
    border-color: var(--gold-primary);
    color: var(--bg-primary);
    box-shadow: 0 0 20px rgba(201, 168, 108, 0.3);
}

.btn-popular-toggle .toggle-icon {
    font-size: 1.3rem;
    transition: transform 0.3s ease;
}

.btn-popular-toggle.active .toggle-icon {
    transform: scale(1.2) rotate(15deg);
}

/* =====================================
   Drag and Drop Styles
   ===================================== */

/* Drag Handle */
.drag-handle {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    color: var(--gold-primary);
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: grab;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
    letter-spacing: -2px;
}

.item-card:hover .drag-handle {
    opacity: 1;
}

.drag-handle:hover {
    background: var(--gold-primary);
    color: var(--bg-primary);
    transform: scale(1.1);
}

.drag-handle:active {
    cursor: grabbing;
}

/* Dragging State */
.item-card.dragging {
    opacity: 0.5;
    transform: scale(1.02);
    box-shadow: 0 10px 30px rgba(201, 168, 108, 0.4);
    border-color: var(--gold-primary);
    z-index: 100;
}

/* Drag Over State */
.item-card.drag-over {
    border: 2px dashed var(--gold-primary);
    background: rgba(201, 168, 108, 0.1);
    transform: scale(1.02);
}

.item-card.drag-over::before {
    content: 'أفلت هنا';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--gold-primary);
    color: var(--bg-primary);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 600;
    z-index: 20;
    animation: pulse 0.8s ease infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
    50% { opacity: 0.8; transform: translate(-50%, -50%) scale(1.05); }
}

/* Make item-card position relative for drag handle */
.item-card.clickable {
    position: relative;
}

/* Touch-friendly adjustments */
@media (max-width: 768px) {
    .drag-handle {
        opacity: 1;
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
}
/* Image Preview Container */
.preview-container {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Edit Image Button Overlay */
.edit-image-btn {
    position: absolute;
    bottom: 10px;
    left: 10px; /* Positioned left for RTL support if needed, or adjust based on preference */
    background-color: var(--color-gold);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    display: flex; /* Centering the icon */
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.edit-image-btn:hover {
    transform: scale(1.1);
    background-color: var(--color-gold-hover);
}

.edit-image-btn.hidden {
    display: none;
}

