/* ============================================
   InvoPOS - Professional Design System
   ============================================ */

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #eef2ff;
    --primary-50: #eef2ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --primary-800: #3730a3;
    --primary-900: #312e81;

    --success: #059669;
    --success-light: #ecfdf5;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --info: #0891b2;
    --info-light: #ecfeff;

    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;

    --sidebar-width: 280px;
    --sidebar-collapsed: 0px;
    --topbar-height: 64px;
    --sidebar-bg: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%);
    --card-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
    --card-shadow-hover: 0 10px 25px rgba(0,0,0,0.08);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
}

* { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
body { background: var(--gray-100); color: var(--gray-800); overflow-x: hidden; line-height: 1.6; }

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    overflow-x: hidden;
    border-right: 1px solid rgba(255,255,255,0.06);
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 24px;
    color: #fff;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}
.sidebar-brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #a5b4fc;
    backdrop-filter: blur(10px);
}

.sidebar-nav { padding: 16px 0; }

.sidebar-heading {
    padding: 16px 24px 8px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255,255,255,0.35);
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 24px;
    color: rgba(255,255,255,0.65);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    margin: 2px 12px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.sidebar-nav .nav-link:hover {
    color: #fff;
    background: rgba(255,255,255,0.08);
}
.sidebar-nav .nav-link.active {
    color: #fff;
    background: rgba(99,102,241,0.35);
    border-left-color: #818cf8;
    box-shadow: 0 2px 8px rgba(99,102,241,0.2);
}
.sidebar-nav .nav-link i {
    font-size: 1.1rem;
    width: 22px;
    text-align: center;
    opacity: 0.9;
}

/* ============================================
   LAYOUT
   ============================================ */
#wrapper { display: flex; }
#wrapper.sidebar-collapsed .sidebar { transform: translateX(-100%); }
#wrapper.sidebar-collapsed #page-content-wrapper { margin-left: 0; }

#page-content-wrapper {
    margin-left: var(--sidebar-width);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 100vh;
}

/* ============================================
   TOP NAVBAR
   ============================================ */
.top-navbar {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    height: var(--topbar-height);
    border-bottom: 1px solid var(--gray-200);
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 1030;
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-700));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(79,70,229,0.3);
}

/* ============================================
   CARDS
   ============================================ */
.card {
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    transition: all 0.2s ease;
    background: #fff;
}
.card:hover { box-shadow: var(--card-shadow-hover); }

.stat-card {
    border-radius: var(--radius);
    overflow: hidden;
}
.stat-card .card-body { padding: 1.5rem; }

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}
.stat-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-icon.success { background: var(--success-light); color: var(--success); }
.stat-icon.warning { background: var(--warning-light); color: var(--warning); }
.stat-icon.danger { background: var(--danger-light); color: var(--danger); }
.stat-icon.info { background: var(--info-light); color: var(--info); }

.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--gray-900);
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.stat-label {
    font-size: 0.8rem;
    color: var(--gray-500);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ============================================
   TABLES
   ============================================ */
.table-card { overflow: hidden; }
.table-card .card-header {
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    padding: 1rem 1.5rem;
}
.table {
    margin-bottom: 0;
    font-size: 0.875rem;
}
.table > :not(caption) > * > * {
    padding: 0.875rem 1rem;
    vertical-align: middle;
}
.table thead th {
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 2px solid var(--gray-200);
}
.table-hover tbody tr:hover { background: var(--gray-50); }
.table tbody td { border-bottom: 1px solid var(--gray-100); }

/* ============================================
   BADGES
   ============================================ */
.badge-status {
    padding: 0.4em 0.85em;
    font-weight: 600;
    font-size: 0.72rem;
    border-radius: 8px;
    letter-spacing: 0.02em;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    font-weight: 600;
    border-radius: var(--radius-sm);
    padding: 0.5rem 1.1rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 2px 6px rgba(79,70,229,0.3);
}
.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(79,70,229,0.4);
    transform: translateY(-1px);
}
.btn-lg { padding: 0.65rem 1.5rem; font-size: 0.95rem; }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; }

/* ============================================
   FORMS
   ============================================ */
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1.5px solid var(--gray-200);
    padding: 0.6rem 0.85rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    background: #fff;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.12);
}
.form-label {
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--gray-700);
    margin-bottom: 0.4rem;
}
.input-group-text {
    background: var(--gray-50);
    border: 1.5px solid var(--gray-200);
    font-size: 0.875rem;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-page {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 50%, #a855f7 100%);
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.05) 0%, transparent 60%);
    animation: rotate 30s linear infinite;
}
@keyframes rotate { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    z-index: 1;
}
.login-card {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 3rem;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
}
.login-logo {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    margin: 0 auto 20px;
    box-shadow: 0 8px 24px rgba(79,70,229,0.4);
}

/* ============================================
   PAGE HEADER
   ============================================ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h4 {
    font-weight: 800;
    color: var(--gray-900);
    margin: 0;
    letter-spacing: -0.02em;
}

/* ============================================
   CHART CONTAINERS
   ============================================ */
.chart-container { position: relative; height: 300px; }

/* ============================================
   MODALS
   ============================================ */
.modal-content { border: none; border-radius: var(--radius-lg); box-shadow: 0 25px 60px rgba(0,0,0,0.15); }
.modal-header { border-bottom: 1px solid var(--gray-200); padding: 1.25rem 1.5rem; }
.modal-body { padding: 1.5rem; }
.modal-footer { border-top: 1px solid var(--gray-200); padding: 1rem 1.5rem; }

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 992px) {
    .sidebar { transform: translateX(-100%); }
    #page-content-wrapper { margin-left: 0; }
    .sidebar.show { transform: translateX(0); box-shadow: 0 0 60px rgba(0,0,0,0.3); }
}
@media (max-width: 768px) {
    .top-navbar { padding: 0 16px; }
    .container-fluid { padding: 16px !important; }
}

/* ============================================
   UTILITIES
   ============================================ */
.text-gradient {
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    .sidebar, .top-navbar, .no-print { display: none !important; }
    #page-content-wrapper { margin: 0 !important; }
    .container-fluid { padding: 0 !important; }
    body { background: #fff; }
    .card { box-shadow: none; border: 1px solid #e5e7eb; }
}

/* ============================================
   INSTALLER
   ============================================ */
.installer-card {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 3rem;
    width: 100%;
    max-width: 550px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.2);
}
.installer-logo {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    margin: 0 auto 20px;
    box-shadow: 0 8px 24px rgba(79,70,229,0.4);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 12px;
    pointer-events: none;
}

.toast-notification {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    min-width: 360px;
    max-width: 440px;
    padding: 18px 20px;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 20px 50px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.04);
    pointer-events: all;
    transform: translateX(120%);
    opacity: 0;
    animation: toastSlideIn 0.5s cubic-bezier(0.16,1,0.3,1) forwards;
    position: relative;
    overflow: hidden;
}

.toast-notification.removing {
    animation: toastSlideOut 0.4s cubic-bezier(0.55,0,1,0.45) forwards;
}

@keyframes toastSlideIn {
    0% { transform: translateX(120%); opacity: 0; }
    100% { transform: translateX(0); opacity: 1; }
}
@keyframes toastSlideOut {
    0% { transform: translateX(0); opacity: 1; }
    100% { transform: translateX(120%); opacity: 0; }
}

.toast-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.toast-content { flex: 1; min-width: 0; }
.toast-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--gray-900);
    margin-bottom: 2px;
}
.toast-message {
    font-size: 0.8rem;
    color: var(--gray-500);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    font-size: 1rem;
    line-height: 1;
    transition: all 0.15s;
    flex-shrink: 0;
    margin-top: 2px;
}
.toast-close:hover { background: var(--gray-100); color: var(--gray-600); }

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 14px 14px;
    animation: toastProgress 4s linear forwards;
}
@keyframes toastProgress {
    0% { width: 100%; }
    100% { width: 0%; }
}

/* Toast Variants */
.toast-success .toast-icon { background: #ecfdf5; color: #059669; }
.toast-success .toast-progress { background: #059669; }

.toast-error .toast-icon { background: #fef2f2; color: #dc2626; }
.toast-error .toast-progress { background: #dc2626; }

.toast-warning .toast-icon { background: #fffbeb; color: #d97706; }
.toast-warning .toast-progress { background: #d97706; }

.toast-info .toast-icon { background: #eff6ff; color: #2563eb; }
.toast-info .toast-progress { background: #2563eb; }

.toast-sale .toast-icon { background: linear-gradient(135deg, #ecfdf5, #d1fae5); color: #059669; }
.toast-sale .toast-progress { background: linear-gradient(90deg, #059669, #10b981); }

@media (max-width: 576px) {
    .toast-container { top: 12px; right: 12px; left: 12px; }
    .toast-notification { min-width: auto; max-width: 100%; }
}
