:root {
    --bg-main: #0a0c10;
    --sidebar-width: 280px;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --surface: #161b22;
    --surface-light: #21262d;
    --border: #30363d;
    --text-main: #e6edf3;
    --text-muted: #8b949e;
    --accent-success: #238636;
    --accent-error: #da3633;
    --accent-warning: #d29922;
    --radius-lg: 12px;
    --radius-md: 8px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    --font-family: 'Outfit', 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-family);
    line-height: 1.5;
    min-height: 100vh;
}

/* Professional Sidebar */
.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    overflow-y: scroll;
    /* Force show scrollbar area */
}

/* Custom Scrollbar for Sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    /* Primary color with transparency */
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
    /* Full primary on hover */
}

.logo {
    padding: 2rem;
    font-size: 1.5rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-main);
    letter-spacing: -1px;
}

.logo i {
    color: var(--primary);
    filter: drop-shadow(0 0 8px var(--primary));
}

.logo span b {
    color: var(--primary);
}

nav {
    flex: 1;
    padding: 0 1rem 3rem;
    /* Extra padding at bottom for scroll visibility */
}

.nav-group-label {
    padding: 1.5rem 1rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    margin-bottom: 0.25rem;
    font-weight: 500;
}

.nav-btn i {
    font-size: 1.1rem;
    width: 20px;
}

.nav-btn:hover {
    background: var(--surface-light);
    color: var(--text-main);
}

.nav-btn.active {
    background: rgba(99, 102, 241, 0.15);
    color: var(--primary);
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Main Content Area */
.content-area {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 2.5rem;
    max-width: 1400px;
}

.top-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.page-title {
    font-size: 1.875rem;
    font-weight: 700;
}

/* SaaS Cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.stat-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.stat-icon {
    font-size: 1.25rem;
    color: var(--primary);
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Forms - Professional View */
.form-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    max-width: 800px;
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
}

.form-control {
    width: 100%;
    background: var(--bg-main);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-size: 0.95rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

textarea.form-control {
    min-height: 120px;
    resize: none;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    border: 1px solid var(--border);
    transition: all 0.2s;
    color: #ffffff !important;
    /* White text for better visibility */
    background: var(--surface-light);
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-block {
    width: 100%;
}

/* Tables */
.table-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: rgba(48, 54, 61, 0.5);
    text-align: left;
    padding: 1rem 1.5rem;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

tr:last-child td {
    border-bottom: none;
}

/* Utilities */
.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: var(--surface-light);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.toast {
    position: fixed;
    bottom: 2rem;
    /* Changed from top to bottom */
    right: 2rem;
    padding: 1rem 1.75rem;
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    gap: 1rem;
    transform: translateX(120%);
    transition: transform 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    z-index: 9999;
    /* Max z-index */
    border: 1px solid var(--border);
    min-width: 320px;
}

/* ... existing toast styles ... */

/* Mobile Menu Button - Ensure High Visibility */
#mobile-menu-btn {
    display: none;
    /* Hidden on desktop by default */
    position: fixed;
    /* User requested LEFT side */
    left: 1.5rem;
    top: 1.5rem;
    z-index: 99999;
    /* Super high z-index to beat everything */
    background: var(--primary);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    transition: transform 0.2s;
}

#mobile-menu-btn:active {
    transform: scale(0.95);
}

@media (max-width: 992px) {
    /* ... existing mobile styles ... */

    #mobile-menu-btn {
        display: flex !important;
        /* Only show on mobile */
    }

    .toast.show {
        transform: translateX(0);
    }

    .toast-icon {
        font-size: 1.25rem;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        flex-shrink: 0;
    }

    .toast-content {
        flex: 1;
    }

    .toast-title {
        font-weight: 700;
        font-size: 0.9rem;
        margin-bottom: 2px;
    }

    .toast-message {
        font-size: 0.8rem;
        color: var(--text-muted);
    }

    /* Toast Variants with Solid Colors */
    .toast-success .toast-icon {
        background: var(--accent-success);
        color: white;
    }

    .toast-error .toast-icon {
        background: var(--accent-error);
        color: white;
    }

    .toast-warning .toast-icon {
        background: var(--accent-warning);
        color: white;
    }

    .toast-info .toast-icon {
        background: var(--primary);
        color: white;
    }

}

/* Responsividade */
@media (max-width: 1200px) {
    :root {
        --sidebar-width: 240px;
    }
}

@media (max-width: 992px) {

    /* Tablet & Mobile Styles */
    :root {
        --sidebar-width: 0px;
    }

    .app-container {
        display: block;
    }

    .sidebar {
        width: 280px;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1100;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.5);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.7);
        backdrop-filter: blur(3px);
        z-index: 1050;
        display: none;
        opacity: 0;
        transition: opacity 0.3s;
    }

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    .content-area {
        margin-left: 0;
        padding: 1.5rem 1rem;
        width: 100%;
    }

    #mobile-menu-btn {
        display: flex !important;
        position: fixed;
        top: 1rem;
        right: 1rem;
        z-index: 1090;
        background: var(--primary);
        color: white;
        border: none;
        width: 45px;
        height: 45px;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        font-size: 1.25rem;
        box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
        cursor: pointer;
    }

    .logo span,
    .nav-group-label,
    .nav-btn span,
    .sidebar-footer {
        display: block;
    }

    .logo {
        justify-content: flex-start;
    }

    .nav-btn {
        justify-content: flex-start;
    }

    .nav-btn i {
        margin-right: 0;
    }

    .stats-grid,
    .form-grid {
        grid-template-columns: 1fr !important;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
    }
}

/* Modal System - NOW ROOT LEVEL */
.modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.85) !important;
    backdrop-filter: blur(5px);
    display: none !important;
    justify-content: center !important;
    align-items: center !important;
    z-index: 1000 !important;
}

.modal-overlay.active {
    display: flex !important;
}

.modal-content {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 95%;
    max-width: 800px;
    padding: 2.5rem;
    box-shadow: var(--shadow);
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
}

.modal-body table {
    margin-top: 1rem;
}

@media (max-width: 600px) {
    .modal-content {
        padding: 1.5rem;
        width: 98%;
    }
}

/* UI Components for Product Actions */
.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    padding: 0.25rem;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn-icon:hover {
    color: var(--primary);
    transform: scale(1.1);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid var(--border);
    cursor: pointer;
    background: var(--primary);
    color: #ffffff;
    transition: all 0.2s;
}

.btn-sm:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}