@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #6366f1; /* Indigo 500 */
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-hover: #4f46e5;
    --secondary: #f43f5e; /* Rose 500 */
    --accent: #10b981; /* Emerald 500 */
    --bg: #0b0f1a; /* Deeper Dark */
    --login-bg: #020617;
    --surface: rgba(15, 23, 42, 0.6);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.12);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --input-bg: rgba(0, 0, 0, 0.2);
    --input-bg-strong: rgba(0, 0, 0, 0.3);
    --hover-bg: rgba(255, 255, 255, 0.05);
    --panel-bg: rgba(15, 23, 42, 0.4);
    --panel-bg-strong: rgba(15, 23, 42, 0.6);
    --scrollbar-track: rgba(0, 0, 0, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-premium: 0 20px 40px -15px rgba(0, 0, 0, 0.5);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-hover: #4f46e5;
    --secondary: #e11d48;
    --accent: #059669;
    --bg: #eef1f8;
    --login-bg: #e2e8f0;
    --surface: rgba(255, 255, 255, 0.8);
    --glass-bg: rgba(15, 23, 42, 0.03);
    --glass-border: rgba(15, 23, 42, 0.1);
    --glass-highlight: rgba(15, 23, 42, 0.18);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --input-bg: rgba(15, 23, 42, 0.045);
    --input-bg-strong: rgba(15, 23, 42, 0.07);
    --hover-bg: rgba(15, 23, 42, 0.05);
    --panel-bg: rgba(255, 255, 255, 0.55);
    --panel-bg-strong: rgba(255, 255, 255, 0.7);
    --scrollbar-track: rgba(15, 23, 42, 0.06);
    --shadow-premium: 0 20px 40px -15px rgba(15, 23, 42, 0.18);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.12) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(244, 63, 94, 0.08) 0px, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Glassmorphism Classes */
.glass {
    background: var(--surface);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.glass-card {
    padding: 1.5rem;
    box-shadow: var(--shadow-premium);
}

.glass-card:hover {
    border-color: var(--glass-highlight);
    transform: translateY(-4px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-main);
}

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

/* Theme Toggle */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    background: var(--glass-bg);
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: var(--transition);
    flex-shrink: 0;
}
.theme-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* Sidebar */
.sidebar {
    width: 260px;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 100;
    border-right: 1px solid var(--glass-border);
}

.nav-item {
    padding: 0.85rem 1.25rem;
    border-radius: 10px;
    color: var(--text-muted);
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 500;
}

.nav-item:hover, .nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

/* Main Content */
.main-layout {
    margin-left: 260px;
    padding: 2rem;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.status-badge {
    padding: 0.35rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-online { background: rgba(16, 185, 129, 0.1); color: var(--accent); border: 1px solid rgba(16, 185, 129, 0.2); }
.status-offline { background: rgba(244, 63, 94, 0.1); color: var(--secondary); border: 1px solid rgba(244, 63, 94, 0.2); }

/* Dashboard Widgets */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.widget-title {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.widget-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
}

/* PDV (Point of Sale) */
.pdv-container {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
    height: calc(100vh - 180px);
    position: relative;
}

.pdv-products {
    overflow-y: auto;
    padding-right: 0.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.pdv-cart {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: var(--panel-bg);
}

/* PDV Mobile Tab Bar */
.pdv-mobile-tabs {
    display: none;
    grid-column: 1 / -1;
    gap: 4px;
    margin-bottom: 0.5rem;
    background: var(--panel-bg-strong);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 4px;
}
.pdv-mobile-tab {
    flex: 1;
    padding: 0.7rem 0.5rem;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}
.pdv-mobile-tab.active {
    background: var(--primary);
    color: white;
}
.pdv-cart-fab {
    display: none;
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 900;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 1rem 2rem;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 8px 25px -3px rgba(99,102,241,0.5);
    white-space: nowrap;
    transition: transform 0.15s;
    animation: slideUp 0.3s ease;
}
.pdv-cart-fab:active { transform: translateX(-50%) scale(0.96); }

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem;
    color: var(--text-muted);
    font-weight: 500;
    border-bottom: 1px solid var(--glass-border);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

/* Animations */
@keyframes slideUp {
    from { transform: translateY(10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.animate-up {
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-fade {
    animation: fadeIn 0.6s ease forwards;
}

/* Utilities */
.desktop-only {
    display: block;
}

@media (max-width: 768px) {
    .desktop-only {
        display: none !important;
    }
}

/* Responsividade Premium */
.mobile-only {
    display: none;
}

@media (max-width: 1024px) {
    .sidebar {
        width: 80px;
        padding: 1.5rem 0.5rem;
    }
    .sidebar h2, .sidebar p, .sidebar .nav-item span, .sidebar .nav-item div:not(#wpp-dot), .sidebar .glass {
        display: none !important;
    }
    .sidebar .nav-item {
        justify-content: center;
        padding: 1rem;
    }
    .main-layout {
        margin-left: 80px;
    }
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }
    .sidebar {
        left: -100%;
        width: 280px;
        transition: left 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        display: flex !important; /* Force flex since it was hidden before */
    }
    .sidebar.open {
        left: 0;
    }
    .sidebar h2, .sidebar p, .sidebar .nav-item span, .sidebar .glass {
        display: block !important;
    }
    .sidebar .nav-item {
        justify-content: flex-start;
    }
    .main-layout {
        margin-left: 0;
        padding: 1rem;
    }
    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }
    .header-actions {
        width: 100%;
        justify-content: space-between;
    }
    .pdv-container {
        grid-template-columns: 1fr;
        height: auto;
        min-height: calc(100vh - 140px);
    }
    .pdv-mobile-tabs { display: flex; }
    .pdv-cart-fab { display: flex; }
    .pdv-panel-hidden { display: none !important; }
    .pdv-products {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 0.6rem;
        padding-right: 0;
        padding-bottom: 5rem;
    }
    .pdv-cart {
        overflow-y: auto;
        padding-bottom: 1rem;
    }
    #cart-items {
        max-height: none !important;
        flex: 1;
    }
    .pdv-keyboard-hints { display: none; }
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }
    .glass-card {
        padding: 1.25rem;
    }
}

/* Scrollbar Style */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}
::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}
