/* Digital Store CMS - Custom CSS */

/* Mobile App-Like Behavior */
html, body {
    touch-action: manipulation;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

button, a, input, select, textarea, label {
    touch-action: manipulation;
}

/* Allow text selection in specific areas */
.selectable-text, textarea, input[type="text"] {
    -webkit-user-select: text;
    user-select: text;
}

.font-tajawal {
    font-family: 'Tajawal', sans-serif;
}

/* Navigation Links */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    color: #a1a1aa;
    transition: all 0.2s;
    min-height: 44px;
}

.nav-link:hover {
    background: rgba(139, 92, 246, 0.1);
    color: #fff;
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(236, 72, 153, 0.2));
    color: #fff;
    border-right: 3px solid #a855f7;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #09090b;
}

::-webkit-scrollbar-thumb {
    background: #27272a;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #3f3f46;
}

/* Cards */
.card {
    background: #0a0a0a;
    border: 1px solid #27272a;
    border-radius: 1rem;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #27272a;
}

.card-body {
    padding: 1.5rem;
}

/* Order Card - Mobile */
.order-card {
    transition: transform 0.15s, box-shadow 0.15s;
}

.order-card:active {
    transform: scale(0.99);
}

/* Stat Cards */
.stat-card {
    background: linear-gradient(135deg, #0a0a0a 0%, #18181b 100%);
    border: 1px solid #27272a;
    border-radius: 1rem;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1) 0%, transparent 70%);
}

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

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

.data-table th {
    padding: 0.75rem 1rem;
    text-align: right;
    font-size: 0.75rem;
    font-weight: 500;
    color: #71717a;
    text-transform: uppercase;
    background: #09090b;
    white-space: nowrap;
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #27272a;
    white-space: nowrap;
}

.data-table tr:hover td {
    background: rgba(139, 92, 246, 0.05);
}

/* Zebra striping */
.data-table tbody tr:nth-child(even) td {
    background: rgba(39, 39, 42, 0.3);
}

.data-table tbody tr:nth-child(even):hover td {
    background: rgba(139, 92, 246, 0.08);
}

/* Sticky header */
.sticky-header th {
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: 0 1px 0 #27272a;
}

/* Forms */
.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: #09090b;
    border: 1px solid #27272a;
    border-radius: 0.5rem;
    color: #fff;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    min-height: 48px;
}

.form-input:focus {
    outline: none;
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.1);
}

.form-input::placeholder {
    color: #52525b;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    font-size: 1rem;
    -webkit-tap-highlight-color: transparent;
    min-height: 44px;
}

.btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn:active:not(:disabled) {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, #9333ea, #db2777);
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    opacity: 0.9;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(147, 51, 234, 0.3);
}

.btn-secondary {
    background: #27272a;
    color: #fff;
}

.btn-secondary:hover:not(:disabled) {
    background: #3f3f46;
}

.btn-danger {
    background: #dc2626;
    color: #fff;
}

.btn-success {
    background: #16a34a;
    color: #fff;
}

/* Toggle Buttons */
.toggle-btn {
    font-weight: 500;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 52px;
}

.toggle-btn:active {
    transform: scale(0.98);
}

.toggle-btn.border-purple-500 {
    border-color: #a855f7 !important;
    background: rgba(168, 85, 247, 0.15) !important;
}

/* Filter Chips */
.filter-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 9999px;
    background: #27272a;
    color: #a1a1aa;
    border: 1px solid transparent;
    transition: all 0.15s;
    cursor: pointer;
    min-height: 36px;
    -webkit-tap-highlight-color: transparent;
}

.filter-chip:hover {
    background: #3f3f46;
    color: #fff;
}

.filter-chip.active {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
    border-color: #a855f7;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
}

.badge-success {
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
}

.badge-warning {
    background: rgba(234, 179, 8, 0.1);
    color: #facc15;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

.badge-purple {
    background: rgba(168, 85, 247, 0.1);
    color: #c084fc;
}

.badge-gray {
    background: rgba(113, 113, 122, 0.1);
    color: #a1a1aa;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 1rem;
    padding-bottom: env(safe-area-inset-bottom, 1rem);
}

.modal-content {
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 1rem;
    padding: 1.5rem;
    width: 100%;
    max-width: 28rem;
    max-height: 90vh;
    overflow-y: auto;
}

/* File Upload */
.file-upload {
    position: relative;
    border: 2px dashed #27272a;
    border-radius: 0.75rem;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    min-height: 100px;
}

.file-upload:hover {
    border-color: #a855f7;
    background: rgba(168, 85, 247, 0.05);
}

.file-upload input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
}

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

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

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

.animate-spin {
    animation: spin 1s linear infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .sidebar-open #sidebar {
        transform: translateX(0);
    }
    
    .sidebar-open #overlay {
        display: block;
    }
}

/* Mobile Optimizations */
@media (max-width: 640px) {
    .card-body {
        padding: 1rem;
    }
    
    .form-input {
        padding: 1rem;
        font-size: 16px; /* Prevent iOS zoom */
    }
    
    .toggle-btn {
        min-height: 56px;
        font-size: 1rem;
    }
    
    .page-title {
        font-size: 1.25rem;
    }
    
    .file-upload {
        padding: 1.5rem 1rem;
    }
    
    .filter-chip {
        font-size: 0.75rem;
        padding: 0.375rem 0.625rem;
    }
}

/* Safe area for mobile */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .pb-safe {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }
    
    .fixed.bottom-0 {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* Sticky bottom bar safe area */
.sticky-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #09090b;
    border-top: 1px solid #27272a;
    padding: 1rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    z-index: 40;
}

/* Updated indicator */
.update-indicator {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(34, 197, 94, 0.9);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    z-index: 50;
    animation: fadeIn 0.3s ease-out;
}
