/* ========================================================
   Hasha Store - Premium Luxury Admin Dashboard
   Modern SaaS / E-Commerce Executive Design
   ======================================================== */

:root {
    --bg-page: #f8fafc;
    --bg-card: #ffffff;
    --bg-card-hover: #f1f5f9;
    --primary: #4f46e5;
    --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #2563eb 100%);
    --primary-hover: #4338ca;
    --accent-glow: rgba(79, 70, 229, 0.25);
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --border: #e2e8f0;
    --border-hover: #cbd5e1;
    
    --success: #10b981;
    --success-bg: #ecfdf5;
    --success-border: #a7f3d0;
    --success-text: #047857;
    
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --danger-border: #fecaca;
    --danger-text: #b91c1c;

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.03);
    --shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 12px 24px -4px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    --shadow-modal: 0 25px 50px -12px rgba(15, 23, 42, 0.25);
    
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    background-color: var(--bg-page);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ================= Security & Login Lock Screen ================= */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: url('https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?q=80&w=2564&auto=format&fit=crop') center/cover no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 24px;
}

.auth-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(15,23,42,0.85) 0%, rgba(2,6,23,0.95) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.auth-card {
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 48px 40px;
    max-width: 420px;
    width: 100%;
    box-shadow: 0 30px 60px -12px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255,255,255,0.1);
    text-align: center;
    position: relative;
    z-index: 1;
    color: #fff;
    animation: authCardEnter 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.auth-lock-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.2) 0%, rgba(37, 99, 235, 0.4) 100%);
    color: #60a5fa;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    margin: 0 auto 24px;
    border: 1px solid rgba(96, 165, 250, 0.3);
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.2);
    position: relative;
}

.auth-lock-icon::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: 24px;
    padding: 1px;
    background: linear-gradient(135deg, rgba(255,255,255,0.4), transparent);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
}

.auth-subtitle {
    font-size: 0.95rem;
    color: #94a3b8;
    margin-bottom: 32px;
    line-height: 1.5;
}

.auth-input-wrap {
    position: relative;
    margin-bottom: 20px;
    text-align: left;
}

.auth-input {
    width: 100%;
    padding: 15px 44px 15px 20px;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    background: rgba(15, 23, 42, 0.4);
    color: #fff;
    transition: var(--transition);
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
}

.auth-input::placeholder {
    color: #64748b;
}

.auth-input:focus {
    background: rgba(15, 23, 42, 0.8);
    border-color: #60a5fa;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2), 0 0 0 4px rgba(59, 130, 246, 0.25);
}

.auth-eye-btn {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    font-size: 1.15rem;
    padding: 4px;
    transition: var(--transition);
}

.auth-eye-btn:hover {
    color: #cbd5e1;
}

.auth-btn-submit {
    width: 100%;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    border: none;
    padding: 15px;
    border-radius: 12px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4), inset 0 1px 0 rgba(255,255,255,0.2);
    transition: all 0.3s ease;
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.auth-btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.6), inset 0 1px 0 rgba(255,255,255,0.2);
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
}

.auth-error-msg {
    color: #fca5a5;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 14px;
    display: none;
    padding: 10px;
    background: rgba(220, 38, 38, 0.15);
    border-radius: 8px;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.auth-error-msg.show {
    display: block;
}

.auth-back-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 28px;
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
    transition: var(--transition);
}

.auth-back-link:hover {
    color: #ffffff;
}

.pro-badge {
    position: absolute;
    top: -12px;
    right: 30px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 4px 10px;
    border-radius: 20px;
    box-shadow: 0 4px 10px rgba(217, 119, 6, 0.4);
    border: 1px solid rgba(255,255,255,0.3);
    letter-spacing: 1px;
}

.shake {
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-2px, 0, 0); }
    20%, 80% { transform: translate3d(4px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-6px, 0, 0); }
    40%, 60% { transform: translate3d(6px, 0, 0); }
}

/* ================= Top Navigation Bar ================= */
.admin-navbar {
    background: #0b1120;
    border-bottom: 1px solid #1e293b;
    padding: 12px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.admin-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #ffffff;
}

.brand-badge {
    background: var(--primary-gradient);
    color: #ffffff;
    font-weight: 900;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.4);
}

.brand-title {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 0.72rem;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 600;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-auth-action {
    background: #1e293b;
    color: #cbd5e1;
    border: 1px solid #334155;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.btn-auth-action:hover {
    background: #334155;
    color: #ffffff;
}

.btn-view-store {
    background: rgba(79, 70, 229, 0.15);
    color: #818cf8;
    border: 1px solid rgba(129, 140, 248, 0.3);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--transition);
}

.btn-view-store:hover {
    background: rgba(79, 70, 229, 0.3);
    color: #ffffff;
}

.btn-auth-logout {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.btn-auth-logout:hover {
    background: var(--danger);
    color: #ffffff;
    border-color: var(--danger);
}

/* ================= Main Container ================= */
.admin-container {
    max-width: 1320px;
    margin: 28px auto;
    padding: 0 24px 60px;
    width: 100%;
    flex: 1;
}

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

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-hover);
    border-color: var(--border-hover);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--border);
    transition: var(--transition);
}

.stat-card:nth-child(1):hover::before { background: #3b82f6; }
.stat-card:nth-child(2):hover::before { background: #10b981; }
.stat-card:nth-child(3):hover::before { background: #ef4444; }
.stat-card:nth-child(4):hover::before { background: #8b5cf6; }

.stat-info h4 {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 6px;
}

.stat-number {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
    line-height: 1;
}

.stat-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.icon-blue { background: #eff6ff; color: #3b82f6; }
.icon-green { background: #ecfdf5; color: #10b981; }
.icon-red { background: #fef2f2; color: #ef4444; }
.icon-purple { background: #f5f3ff; color: #8b5cf6; }

/* Management Toolbar */
.toolbar-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 18px 22px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-card);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.toolbar-filters {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1;
}

.admin-search-input {
    padding: 10px 16px 10px 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    background: #f8fafc;
    min-width: 280px;
    outline: none;
    transition: var(--transition);
}

.admin-search-input:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.filter-select {
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: #f8fafc;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-main);
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.filter-select:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.toolbar-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    border: none;
    padding: 11px 20px;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(79, 70, 229, 0.3);
    transition: var(--transition);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.4);
}

.btn-outline-danger {
    background: #ffffff;
    color: var(--danger);
    border: 1px solid var(--danger-border);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-outline-danger:hover {
    background: var(--danger-bg);
}

/* Products Table */
.table-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
    overflow: hidden;
}

.table-responsive {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.admin-table th {
    background: #f8fafc;
    padding: 16px 20px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
    vertical-align: middle;
    transition: var(--transition);
}

.admin-table tbody tr {
    transition: var(--transition);
}

.admin-table tbody tr:hover {
    background: #f8fafc;
}

/* Product Info Cell */
.prod-meta-cell {
    display: flex;
    align-items: center;
    gap: 16px;
}

.table-prod-img {
    width: 58px;
    height: 58px;
    border-radius: var(--radius-md);
    object-fit: cover;
    background: #f1f5f9;
    border: 1px solid var(--border);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.prod-cell-name {
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.95rem;
}

.prod-cell-cat {
    font-size: 0.75rem;
    color: #4338ca;
    font-weight: 700;
    background: #e0e7ff;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    display: inline-block;
    letter-spacing: 0.3px;
}

/* Stock Status Switch Button */
.stock-toggle-btn {
    padding: 7px 16px;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.stock-in {
    background: #dcfce7;
    color: #15803d;
    border-color: #86efac;
}

.stock-in:hover {
    background: #bbf7d0;
    transform: scale(1.02);
}

.stock-out {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fca5a5;
}

.stock-out:hover {
    background: #fecaca;
    transform: scale(1.02);
}

/* Table Row Action Buttons */
.row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-muted);
    transition: var(--transition);
}

.btn-icon.edit:hover {
    background: #eff6ff;
    color: var(--primary);
    border-color: #bfdbfe;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.15);
}

.btn-icon.delete:hover {
    background: #fef2f2;
    color: var(--danger);
    border-color: var(--danger-border);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
}

/* ================= Modal Styling ================= */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    z-index: 300;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal-overlay.active {
    display: flex;
}

.modal-box {
    background: #ffffff;
    border-radius: var(--radius-xl);
    max-width: 620px;
    width: 100%;
    box-shadow: var(--shadow-modal);
    position: relative;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

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

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.modal-body {
    padding: 28px;
    overflow-y: auto;
}

.modal-footer {
    padding: 18px 28px;
    border-top: 1px solid var(--border);
    background: #f8fafc;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
}

.form-group {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    outline: none;
    background: #ffffff;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3.5px var(--accent-glow);
}

/* Image preview container */
.image-preview-box {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 10px;
    padding: 12px;
    background: #f8fafc;
    border-radius: var(--radius-md);
    border: 1.5px dashed var(--border);
}

.img-preview-thumb {
    width: 68px;
    height: 68px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    background: #e2e8f0;
    border: 1px solid var(--border);
}

/* Toggle Switch */
.switch-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #f8fafc;
    border-radius: var(--radius-md);
    border: 1.5px solid var(--border);
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
    border-radius: 26px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #10b981;
}

input:checked + .slider:before {
    transform: translateX(24px);
}

/* Toast */
.admin-toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    background: #0f172a;
    color: #ffffff;
    padding: 14px 22px;
    border-radius: var(--radius-md);
    font-size: 0.92rem;
    font-weight: 600;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.25);
    z-index: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-toast.show {
    transform: translateY(0);
    opacity: 1;
}

@media (max-width: 768px) {
    .admin-navbar {
        padding: 12px 16px;
    }
    .admin-container {
        padding: 0 16px 40px;
    }
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
    .toolbar-card {
        flex-direction: column;
        align-items: stretch;
    }
    .toolbar-filters {
        flex-direction: column;
        align-items: stretch;
    }
    .admin-search-input {
        min-width: 100%;
    }
}

/* ================= Admin Tabs ================= */
.admin-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--admin-border);
    padding-bottom: 10px;
}
.admin-tab-btn {
    background: transparent;
    border: none;
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--admin-text-muted);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
}
.admin-tab-btn:hover {
    background: var(--admin-bg);
    color: var(--admin-text);
}
.admin-tab-btn.active {
    background: var(--admin-primary);
    color: white;
}
.admin-tab-content {
    display: none;
}
.admin-tab-content.active {
    display: block;
}
