/* design-system.css - Solid, Professional & Clean Aesthetics */
/* Purpose: Core design system untuk SuperStore Dashboard */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');
@import url('https://cdn.jsdelivr.net/npm/remixicon@3.5.0/fonts/remixicon.css');
@import url('./variables.css');

/* ========================================
   CSS RESET& BASE
   ======================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html {
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: var(--leading-normal);
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main, .main-content {
    flex: 1;
}

/* ========================================
   TYPOGRAPHY BASE
   ======================================== */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--font-bold);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-base); }

p {
    line-height: var(--leading-relaxed);
}

/* ========================================
   LINKS
   ======================================== */
a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-blue);
}

/* ========================================
   BUTTONS BASE
   ======================================== */
button {
    font-family: var(--font-family);
    cursor: pointer;
    border: none;
    outline: none;
    background: none;
}

button:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* ========================================
   TOAST NOTIFICATIONS SYSTEM
   ======================================== */
#toast-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    z-index: var(--z-toast);
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    background: var(--surface-primary);
    color: var(--text-primary);
    padding: var(--space-4) var(--space-5);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    font-weight: var(--font-semibold);
    font-size: var(--text-sm);
    min-width: 320px;
    max-width: 420px;
    position: relative;
    overflow: hidden;

    /* Smooth slide-in animation */
    opacity: 0;
    transform: translateX(100%);
    transition: all var(--transition-smooth);
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast.hide {
    opacity: 0;
    transform: translateX(100%);
}

/* Toast Content */
.toast-content {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 1;
}

.toast-icon {
    font-size: var(--text-xl);
    flex-shrink: 0;
}

.toast-message {
    line-height: var(--leading-normal);
}

/* Toast Close Button */
.toast-close {
    background: transparent;
    border: none;
    padding: var(--space-1);
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--surface-secondary);
    color: var(--text-primary);
}

.toast-close i {
    font-size: var(--text-base);
}

/* Toast Progress Bar */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: currentColor;
    opacity: 0.3;
    animation: toast-timer linear forwards;
}

@keyframes toast-timer {
    from { width: 100%; }
    to { width: 0%; }
}

/* Toast Variants */
.toast-success {
    border-left: 4px solid var(--accent-emerald);
}

.toast-success .toast-icon { color: var(--accent-emerald); }
.toast-success .toast-progress { background: var(--accent-emerald); }

.toast-error {
    border-left: 4px solid var(--accent-rose);
}

.toast-error .toast-icon { color: var(--accent-rose); }
.toast-error .toast-progress { background: var(--accent-rose); }

.toast-warning {
    border-left: 4px solid var(--accent-amber);
}

.toast-warning .toast-icon { color: var(--accent-amber); }
.toast-warning .toast-progress { background: var(--accent-amber); }

.toast-info {
    border-left: 4px solid var(--accent-blue);
}

.toast-info .toast-icon { color: var(--accent-blue); }
.toast-info .toast-progress { background: var(--accent-blue); }

/* ========================================
   CUSTOM SCROLLBAR
   ======================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--surface-secondary);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb {
    background: var(--slate-300);
    border-radius: var(--radius-full);
    transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--slate-400);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--slate-300) var(--surface-secondary);
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

/* Text Colors */
.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--accent-emerald); }
.text-danger { color: var(--accent-rose); }
.text-warning { color: var(--accent-amber); }
.text-info { color: var(--accent-blue); }

/* Text Sizes */
.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }

/* Font Weights */
.font-normal { font-weight: var(--font-normal); }
.font-medium { font-weight: var(--font-medium); }
.font-semibold { font-weight: var(--font-semibold); }
.font-bold { font-weight: var(--font-bold); }

/* Spacing */
.m-0 { margin: 0; }
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

/* Flexbox */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* Display */
.hidden { display: none; }
.block { display: block; }
.inline-flex { display: inline-flex; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }

/* Border Radius */
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* Shadows */
.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

/* Transitions */
.transition { transition: all var(--transition-base); }
.transition-fast { transition: all var(--transition-fast); }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

/* ========================================
   BADGES
   ======================================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-1) var(--space-3);
    font-size: var(--text-xs);
    font-weight: var(--font-semibold);
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: var(--accent-emerald-light);
    color: var(--accent-emerald);
}

.badge-danger {
    background: var(--accent-rose-light);
    color: var(--accent-rose);
}

.badge-warning {
    background: var(--accent-amber-light);
    color: var(--accent-amber);
}

.badge-info {
    background: var(--accent-blue-light);
    color: var(--accent-blue);
}

.badge-violet {
    background: var(--accent-violet-light);
    color: var(--accent-violet);
}

/* ========================================
   ICON BUTTONS
   ======================================== */
.icon-btn {
    background: var(--surface-primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
    color: var(--text-secondary);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
}

.icon-btn:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
    color: var(--text-primary);
}

.icon-btn.danger:hover {
    background: var(--accent-rose-light);
    color: var(--accent-rose);
}

.icon-btn.success:hover {
    background: var(--accent-emerald-light);
    color: var(--accent-emerald);
}

/* ========================================
   CLOSE BUTTON
   ======================================== */
.close-btn {
    background: var(--surface-secondary);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-lg);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.close-btn:hover {
    background: var(--accent-rose-light);
    color: var(--accent-rose);
}

/* ========================================
   LOADING SPINNER
   ======================================== */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--slate-200);
    border-right-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin0.6s linear infinite;
}

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

/* ========================================
   PAGE ANIMATIONS
   ======================================== */
.page-content {
    animation: fade-slide-in var(--duration-normal) ease-out;
}

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

/* Stagger animation for lists */
.stagger-list > * {
    animation: fade-slide-in var(--duration-normal) ease-out both;
}

.stagger-list > *:nth-child(1) { animation-delay: 0ms; }
.stagger-list > *:nth-child(2) { animation-delay: 50ms; }
.stagger-list > *:nth-child(3) { animation-delay: 100ms; }
.stagger-list > *:nth-child(4) { animation-delay: 150ms; }
.stagger-list > *:nth-child(5) { animation-delay: 200ms; }
.stagger-list > *:nth-child(6) { animation-delay: 250ms; }

/* ========================================
   ACCESSIBILITY
   ======================================== */
*:focus-visible {
    outline: 2px solid var(--accent-blue);
    outline-offset: 2px;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========================================
   EMPTY STATE
   ======================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-12) var(--space-6);
    text-align: center;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-full);
    background: var(--surface-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--text-muted);
    margin-bottom: var(--space-5);
}

.empty-state-title {
    font-size: var(--text-lg);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.empty-state-description {
    font-size: var(--text-sm);
    color: var(--text-muted);
    max-width: 320px;
    margin-bottom: var(--space-5);
}

/* ========================================
   SKELETON LOADING
   ======================================== */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--slate-100) 25%,
        var(--slate-200) 50%,
        var(--slate-100) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-md);
}

.skeleton-text {
    height: 14px;
    border-radius: var(--radius-sm);
}

.skeleton-title {
    height: 24px;
    width: 60%;
    border-radius: var(--radius-sm);
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
}

.skeleton-card {
    height: 120px;
    border-radius: var(--radius-lg);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========================================
   RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
    #toast-container {
        left: var(--space-4);
        right: var(--space-4);
        bottom: var(--space-4);
    }

    .toast {
        min-width: auto;
        width: 100%;
    }

    .table-search {
        width: 100%;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ========================================
   GLOBAL CONFIRM DIALOG
   ======================================== */
.confirm-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

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

.confirm-modal {
    background: var(--surface-primary, #ffffff);
    width: 90%;
    max-width: 400px;
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-xl, 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04));
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s ease;
    overflow: hidden;
    padding: 2rem;
    text-align: center;
}

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

.confirm-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-rose-light, #ffe4e6);
    color: var(--accent-rose, #e11d48);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1.5rem;
}

.confirm-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-dark, #1e293b);
    margin-bottom: 0.75rem;
}

.confirm-message {
    font-size: 0.95rem;
    color: var(--text-muted, #64748b);
    margin-bottom: 2rem;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.confirm-btn {
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md, 12px);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    flex: 1;
}

.confirm-btn.cancel {
    background: var(--surface-secondary, #f1f5f9);
    color: var(--text-secondary, #475569);
}

.confirm-btn.cancel:hover {
    background: #e2e8f0;
}

.confirm-btn.confirm {
    background: var(--accent-rose, #e11d48);
    color: #ffffff;
}

.confirm-btn.confirm:hover {
    background: #be123c;
}

/* ========================================
   2026 UX TRENDS
   ======================================== */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ========================================
   TOGGLE SWITCHES
   ======================================== */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

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

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--slate-300, #cbd5e1);
    transition: .3s ease;
    border-radius: 26px;
}

.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s cubic-bezier(0.4, 0.0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .slider {
    background-color: var(--accent-blue, #3b82f6);
}

.toggle-switch input:checked + .slider:before {
    transform: translateX(22px);
}