/* =============================================
   SistemaPos Pro — Main Stylesheet
   ============================================= */

:root {
    /* Brand Colors */
    --primary:        #6366f1;
    --primary-hover:  #4f46e5;
    --primary-light:  #e0e7ff;
    --secondary:      #0ea5e9;
    --success:        #10b981;
    --warning:        #f59e0b;
    --danger:         #ef4444;
    --info:           #06b6d4;

    /* Sidebar */
    --sidebar-bg:     #0f172a;
    --sidebar-hover:  #1e293b;
    --sidebar-active: #6366f1;
    --sidebar-text:   #94a3b8;
    --sidebar-width:  260px;

    /* Layout */
    --navbar-height:  60px;
    --body-bg:        #f1f5f9;
    --card-bg:        #ffffff;

    /* Typography */
    --font-family:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --text-primary:   #1e293b;
    --text-secondary: #64748b;
    --text-muted:     #94a3b8;

    /* Shadows */
    --shadow-sm:  0 1px 2px rgba(0,0,0,.05);
    --shadow-md:  0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -2px rgba(0,0,0,.05);
    --shadow-lg:  0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -4px rgba(0,0,0,.04);

    /* Transitions */
    --transition: all .2s ease;

    /* Border Radius */
    --radius:    .5rem;
    --radius-lg: .75rem;
}

/* --------- Reset & Base --------- */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--body-bg);
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* --------- App Wrapper --------- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* =============================================
   SIDEBAR
   ============================================= */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--sidebar-bg);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
    overflow-x: hidden;
}

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

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.25rem .75rem;
    border-bottom: 1px solid rgba(255,255,255,.06);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .6rem;
    color: #fff;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -.02em;
}
.sidebar-brand i {
    font-size: 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-toggle {
    color: var(--sidebar-text);
    font-size: 1.2rem;
    text-decoration: none;
}

/* Nav Items */
.sidebar-nav {
    list-style: none;
    padding: .75rem 0;
    margin: 0;
    flex: 1;
}

.sidebar-item {
    margin: 2px .6rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .65rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius);
    font-size: .875rem;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
}

.sidebar-link:hover {
    color: #fff;
    background: var(--sidebar-hover);
}

.sidebar-link i:first-child {
    font-size: 1.15rem;
    min-width: 1.25rem;
    text-align: center;
}

.sidebar-item.active > .sidebar-link {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    box-shadow: 0 4px 12px rgba(99,102,241,.35);
}

/* Submenu */
.submenu-arrow {
    font-size: .7rem;
    transition: transform .3s ease;
}
.sidebar-link[aria-expanded="true"] .submenu-arrow {
    transform: rotate(180deg);
}

.sidebar-submenu {
    list-style: none;
    padding: 0 0 0 2.5rem;
    margin: 0;
}

.sidebar-sublink {
    display: block;
    padding: .4rem .75rem;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: .8125rem;
    border-radius: var(--radius);
    transition: var(--transition);
    margin: 1px 0;
}
.sidebar-sublink:hover,
.sidebar-sublink.active {
    color: #fff;
    background: var(--sidebar-hover);
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: .65rem;
}
.user-avatar i {
    font-size: 2rem;
    color: var(--primary);
}
.user-name {
    color: #e2e8f0;
    font-size: .875rem;
    font-weight: 600;
    display: block;
}
.user-role {
    color: var(--sidebar-text);
    font-size: .75rem;
}

/* =============================================
   MAIN CONTENT
   ============================================= */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin .3s ease;
}

/* --------- Top Navbar --------- */
.top-navbar {
    position: sticky;
    top: 0;
    z-index: 1030;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--navbar-height);
    padding: 0 1.5rem;
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid #e2e8f0;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.navbar-left .sidebar-toggle {
    font-size: 1.4rem;
    color: var(--text-secondary);
    display: none;
}
.navbar-left .page-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: .5rem;
}

/* Notification Bell */
.notification-bell {
    position: relative;
    font-size: 1.25rem;
    color: var(--text-secondary);
    padding: .35rem;
    text-decoration: none;
}
.notification-badge {
    position: absolute;
    top: 0;
    right: -2px;
    background: var(--danger);
    color: #fff;
    font-size: .65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    line-height: 1;
}

/* Notification Dropdown */
.notification-dropdown {
    width: 340px;
    max-height: 400px;
    border: none;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-lg);
    padding: 0;
    overflow: hidden;
}
.notification-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
}
.notification-body {
    max-height: 300px;
    overflow-y: auto;
}
.notification-item {
    display: flex;
    align-items: flex-start;
    gap: .65rem;
    padding: .75rem 1rem;
    border-bottom: 1px solid #f1f5f9;
    transition: background .15s ease;
    cursor: pointer;
}
.notification-item:hover {
    background: #f8fafc;
}
.notification-item.unread {
    background: var(--primary-light);
}
.notification-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: .9rem;
}
.notification-icon.stock  { background: #fef3c7; color: var(--warning); }
.notification-icon.danger { background: #fee2e2; color: var(--danger);  }
.notification-icon.info   { background: #e0f2fe; color: var(--info);    }

/* User Dropdown */
.user-dropdown {
    display: flex;
    align-items: center;
    gap: .4rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: .875rem;
}
.user-dropdown .bi-person-circle {
    font-size: 1.35rem;
}

/* --------- Page Content --------- */
.page-content {
    padding: 1.5rem;
    flex: 1;
}

/* =============================================
   CARDS
   ============================================= */
.card {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    background: var(--card-bg);
}
.card:hover {
    box-shadow: var(--shadow-md);
}
.card-header {
    background: none;
    border-bottom: 1px solid #f1f5f9;
    padding: 1rem 1.25rem;
    font-weight: 600;
}

/* Stat Cards */
.stat-card {
    position: relative;
    overflow: hidden;
    padding: 1.25rem;
}
.stat-card .stat-icon {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}
.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    margin: .25rem 0;
    line-height: 1.2;
}
.stat-card .stat-label {
    font-size: .8125rem;
    color: var(--text-secondary);
    font-weight: 500;
}
.stat-icon.primary   { background: var(--primary-light); color: var(--primary);  }
.stat-icon.success   { background: #d1fae5; color: var(--success); }
.stat-icon.warning   { background: #fef3c7; color: var(--warning); }
.stat-icon.info      { background: #e0f2fe; color: var(--info);    }
.stat-icon.danger    { background: #fee2e2; color: var(--danger);  }

/* =============================================
   TABLES
   ============================================= */
.table {
    font-size: .875rem;
}
.table thead th {
    background: #f8fafc;
    border-bottom: 2px solid #e2e8f0;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: .75rem;
    letter-spacing: .05em;
    padding: .75rem 1rem;
    white-space: nowrap;
}
.table tbody td {
    padding: .75rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}
.table-hover tbody tr:hover {
    background: #f8fafc;
}

/* =============================================
   BADGES
   ============================================= */
.badge-status {
    padding: .3rem .65rem;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
}
.badge-status.active   { background: #d1fae5; color: #065f46; }
.badge-status.inactive { background: #fee2e2; color: #991b1b; }
.badge-status.low      { background: #fef3c7; color: #92400e; }
.badge-status.critical { background: #fee2e2; color: #991b1b; }

/* =============================================
   BUTTONS
   ============================================= */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
}
.btn-success {
    background: var(--success);
    border-color: var(--success);
}
.btn-success:hover {
    background: #059669;
    border-color: #059669;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
}

/* =============================================
   FORMS
   ============================================= */
.form-control, .form-select {
    border-radius: var(--radius);
    border: 1px solid #e2e8f0;
    font-size: .875rem;
    padding: .5rem .75rem;
    transition: var(--transition);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

/* =============================================
   MODALS
   ============================================= */
.modal-content {
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}
.modal-header {
    border-bottom: 1px solid #f1f5f9;
    padding: 1rem 1.25rem;
}
.modal-footer {
    border-top: 1px solid #f1f5f9;
    padding: .75rem 1.25rem;
}

/* =============================================
   TOAST
   ============================================= */
.custom-toast {
    min-width: 300px;
    border: none;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: .875rem;
    animation: slideInRight .3s ease;
}
.custom-toast.success { border-left: 4px solid var(--success); }
.custom-toast.danger  { border-left: 4px solid var(--danger);  }
.custom-toast.warning { border-left: 4px solid var(--warning); }
.custom-toast.info    { border-left: 4px solid var(--info);    }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* =============================================
   LOGIN PAGE
   ============================================= */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    position: relative;
    overflow: hidden;
}
.login-wrapper::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(99,102,241,.2), transparent 70%);
    top: -100px;
    right: -100px;
}
.login-wrapper::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(14,165,233,.15), transparent 70%);
    bottom: -80px;
    left: -80px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: rgba(255,255,255,.95);
    backdrop-filter: blur(20px);
    border-radius: 1rem;
    padding: 2.5rem 2rem;
    box-shadow: 0 25px 50px rgba(0,0,0,.25);
    position: relative;
    z-index: 1;
    animation: fadeInUp .5s ease;
}
.login-card .brand {
    text-align: center;
    margin-bottom: 2rem;
}
.login-card .brand i {
    font-size: 3rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
.login-card .brand h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: .5rem;
    color: var(--text-primary);
}
.login-card .brand p {
    color: var(--text-secondary);
    font-size: .875rem;
}

@keyframes fadeInUp {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

/* =============================================
   SEARCH BAR (POS & general)
   ============================================= */
.search-box {
    position: relative;
}
.search-box .bi-search {
    position: absolute;
    left: .75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}
.search-box input {
    padding-left: 2.25rem;
}

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .navbar-left .sidebar-toggle {
        display: block;
    }
    /* Overlay */
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.5);
        z-index: 1035;
        display: none;
    }
    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 575.98px) {
    .page-content {
        padding: 1rem;
    }
    .stat-card .stat-value {
        font-size: 1.35rem;
    }
}

/* =============================================
   MISCELLANEOUS
   ============================================= */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state i {
    font-size: 3rem;
    margin-bottom: .75rem;
    display: block;
}

.cursor-pointer { cursor: pointer; }

/* Scrollbar style */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Loading spinner overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.7);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}
