/* buttons.css - Button System untuk SuperStore Dashboard */
/* Purpose: Unified button styles dengan semantic naming */

@import url('https://cdn.jsdelivr.net/npm/remixicon@3.5.0/fonts/remixicon.css');

/* ========================================
   BASE BUTTON
   ======================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-family: var(--font-family);
    font-size: var(--text-sm);
    font-weight: var(--font-semibold);
    line-height: var(--leading-normal);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    text-decoration: none;
    user-select: none;
}

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

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* ========================================
   BUTTON SIZES
   ======================================== */
.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: var(--text-xs);
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: var(--space-4) var(--space-6);
    font-size: var(--text-base);
    border-radius: var(--radius-lg);
}

.btn-xl {
    padding: var(--space-5) var(--space-8);
    font-size: var(--text-lg);
    border-radius: var(--radius-lg);
}

/* ========================================
   BUTTON VARIANTS - Primary Colors
   ======================================== */

/* Primary - Dark slate (default for dashboard) */
.btn-primary {
    background: var(--slate-900);
    color: var(--text-inverse);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: var(--slate-800);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Secondary - Outlined/light variant */
.btn-secondary {
    background: var(--surface-primary);
    color: var(--text-primary);
    border: 1px solid var(--slate-200);
    box-shadow: var(--shadow-xs);
}

.btn-secondary:hover {
    background: var(--surface-secondary);
    border-color: var(--slate-300);
}

.btn-secondary:active {
    background: var(--slate-200);
}

/* Ghost - Minimal visual weight */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

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

/* ========================================
   BUTTON VARIANTS - Semantic Colors
   ======================================== */

/* Success / Accent (Green) - For positive actions */
.btn-accent,
.btn-success {
    background: var(--accent-emerald);
    color: var(--text-inverse);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-accent:hover,
.btn-success:hover {
    background: #059669;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
    transform: translateY(-1px);
}

.btn-accent:active,
.btn-success:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

/* Danger (Red) - For destructive actions */
.btn-danger {
    background: var(--accent-rose);
    color: var(--text-inverse);
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.25);
}

.btn-danger:hover {
    background: #e11d48;
    box-shadow: 0 6px 16px rgba(244, 63, 94, 0.35);
    transform: translateY(-1px);
}

.btn-danger:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(244, 63, 94, 0.25);
}

/* Warning (Amber) - For caution actions */
.btn-warning {
    background: var(--accent-amber);
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.btn-warning:hover {
    background: #d97706;
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.35);
    transform: translateY(-1px);
}

/* Info (Blue) - For informational actions */
.btn-info {
    background: var(--accent-blue);
    color: var(--text-inverse);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.btn-info:hover {
    background: #2563eb;
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
    transform: translateY(-1px);
}

/* Premium (Violet) - For special/premium actions */
.btn-premium {
    background: linear-gradient(135deg, var(--accent-violet) 0%, #7c3aed 100%);
    color: var(--text-inverse);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.btn-premium:hover {
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.4);
    transform: translateY(-1px);
}

/* ========================================
   OUTLINED VARIANTS
   ======================================== */
.btn-outline-primary {
    background: transparent;
    color: var(--slate-900);
    border: 1.5px solid var(--slate-900);
}

.btn-outline-primary:hover {
    background: var(--slate-900);
    color: var(--text-inverse);
}

.btn-outline-accent {
    background: transparent;
    color: var(--accent-emerald);
    border: 1.5px solid var(--accent-emerald);
}

.btn-outline-accent:hover {
    background: var(--accent-emerald);
    color: var(--text-inverse);
}

.btn-outline-danger {
    background: transparent;
    color: var(--accent-rose);
    border: 1.5px solid var(--accent-rose);
}

.btn-outline-danger:hover {
    background: var(--accent-rose);
    color: var(--text-inverse);
}

/* ========================================
   ICON BUTTON
   ======================================== */
.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-md);
    flex-shrink: 0;
}

.btn-icon.btn-sm {
    width: 32px;
    height: 32px;
    font-size: var(--text-sm);
}

.btn-icon.btn-lg {
    width: 48px;
    height: 48px;
    font-size: var(--text-xl);
}

.btn-icon-circle {
    border-radius: var(--radius-full);
}

/* ========================================
   LOADING STATE
   ======================================== */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.6s linear infinite;
}

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

/* Spinner colors based on button variant */
.btn-primary.btn-loading::after,
.btn-success.btn-loading::after,
.btn-danger.btn-loading::after,
.btn-info.btn-loading::after,
.btn-premium.btn-loading::after {
    border-color: rgba(255, 255, 255, 0.8);
    border-right-color: transparent;
}

.btn-secondary.btn-loading::after,
.btn-ghost.btn-loading::after {
    border-color: var(--slate-400);
    border-right-color: transparent;
}

/* ========================================
   BUTTON GROUPS
   ======================================== */
.btn-group {
    display: inline-flex;
    gap: var(--space-2);
}

.btn-group .btn {
    border-radius: 0;
}

.btn-group .btn:first-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.btn-group .btn:last-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

/* ========================================
   BUTTON WITH BADGE
   ======================================== */
.btn-badge {
    position: relative;
}

.btn-badge::after {
    content: attr(data-badge);
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 10px;
    font-weight: var(--font-bold);
    line-height: 18px;
    text-align: center;
    background: var(--accent-rose);
    color: var(--text-inverse);
    border-radius: var(--radius-full);
}

/* ========================================
   SPECIAL BUTTONS - Download/Upload
   ======================================== */
.btn-download {
    background: var(--accent-emerald);
    color: var(--text-inverse);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-download:hover {
    background: #059669;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.35);
    transform: translateY(-1px);
}

.btn-upload {
    background: var(--accent-blue);
    color: var(--text-inverse);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.btn-upload:hover {
    background: #2563eb;
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.35);
    transform: translateY(-1px);
}

/* ========================================
   GRADIENT BUTTONS
   ======================================== */
.btn-gradient-blue {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(79, 172, 254, 0.3);
}

.btn-gradient-blue:hover {
    box-shadow: 0 6px 16px rgba(79, 172, 254, 0.4);
    transform: translateY(-1px);
}

.btn-gradient-pink {
    background: linear-gradient(135deg, #ff758c 0%, #ff7eb3 100%);
    color: var(--text-inverse);
    box-shadow: 0 4px 12px rgba(255, 117, 140, 0.3);
}

.btn-gradient-pink:hover {
    box-shadow: 0 6px 16px rgba(255, 117, 140, 0.4);
    transform: translateY(-1px);
}

.btn-gradient-indigo {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-inverse);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-gradient-indigo:hover {
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    transform: translateY(-1px);
}

/* ========================================
   BUTTON WITH PROGRESS
   ======================================== */
.btn-progress {
    position: relative;
    overflow: hidden;
}

.btn-progress::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.5);
    transition: width 0.3s ease;
}

.btn-progress.active::after {
    width: 100%;
    animation: progress-bar 2s ease-in-out infinite;
}

@keyframes progress-bar {
    0% { width: 0%; }
    50% { width: 100%; }
    100% { width: 0%; }
}

/* ========================================
   RESPONSIVE BUTTONS
   ======================================== */
@media (max-width: 640px) {
    .btn {
        padding: var(--space-3) var(--space-4);
    }

    .btn-lg {
        padding: var(--space-3) var(--space-5);
        font-size: var(--text-sm);
    }

    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group .btn {
        border-radius: var(--radius-md);
    }

    .btn-group .btn:first-child {
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }

    .btn-group .btn:last-child {
        border-radius: 0 0 var(--radius-md) var(--radius-md);
    }
}