/* ========================================
   QUINTAL BURGERS - PDV SYSTEM
   Main Stylesheet - Variables & Base
   ======================================== */

:root {
    /* Colors - Warm Restaurant Theme */
    --primary: #E85D04;
    --primary-dark: #D35400;
    --primary-light: #FF8C42;
    --secondary: #1A1A2E;
    --secondary-light: #16213E;
    
    --success: #27AE60;
    --success-light: #2ECC71;
    --warning: #F39C12;
    --warning-light: #F1C40F;
    --danger: #E74C3C;
    --danger-light: #FF6B6B;
    --info: #3498DB;
    
    --bg-dark: #0F0F1A;
    --bg-card: #1A1A2E;
    --bg-card-hover: #252542;
    --bg-input: #12121F;
    
    --text-primary: #FFFFFF;
    --text-secondary: #A0A0B0;
    --text-muted: #6C6C7E;
    
    --border-color: #2A2A40;
    --border-light: #3A3A50;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 20px rgba(232, 93, 4, 0.3);
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    --spacing-2xl: 48px;
    
    /* Border Radius */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 50%;
    
    /* Fonts */
    --font-display: 'Bebas Neue', sans-serif;
    --font-body: 'DM Sans', sans-serif;
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
    --transition-slow: 0.4s ease;
    
    /* Sidebar */
    --sidebar-width: 260px;
    --sidebar-collapsed: 80px;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    min-height: -webkit-fill-available;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 400;
    letter-spacing: 0.02em;
    line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.25rem; }

p { color: var(--text-secondary); }

a {
    text-decoration: none;
    color: inherit;
    transition: color var(--transition-fast);
}

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

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-sm);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-light);
}

/* Form Elements */
input, select, textarea, button {
    font-family: var(--font-body);
    font-size: 1rem;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

input, select, textarea {
    width: 100%;
    padding: var(--spacing-md);
    background: var(--bg-input);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    -webkit-border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    -webkit-transition: all var(--transition-fast);
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23A0A0B0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.2);
    -webkit-box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.2);
}

input::placeholder {
    color: var(--text-muted);
}

input::-webkit-input-placeholder { color: var(--text-muted); }
input::-moz-placeholder { color: var(--text-muted); }

/* Buttons */
.btn {
    display: -webkit-inline-flex;
    display: inline-flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-md) var(--spacing-lg);
    border: none;
    border-radius: var(--radius-md);
    -webkit-border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    -webkit-transition: all var(--transition-fast);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    -webkit-tap-highlight-color: transparent;
}

.btn:hover {
    -webkit-transform: translateY(-2px);
    transform: translateY(-2px);
}

.btn:active {
    -webkit-transform: translateY(0);
    transform: translateY(0);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    background: -webkit-linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: var(--shadow-md);
    -webkit-box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    background: -webkit-linear-gradient(135deg, var(--primary-light), var(--primary));
    box-shadow: var(--shadow-glow);
    -webkit-box-shadow: var(--shadow-glow);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #1E8449);
    background: -webkit-linear-gradient(135deg, var(--success), #1E8449);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, var(--success-light), var(--success));
    background: -webkit-linear-gradient(135deg, var(--success-light), var(--success));
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #C0392B);
    background: -webkit-linear-gradient(135deg, var(--danger), #C0392B);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, var(--danger-light), var(--danger));
    background: -webkit-linear-gradient(135deg, var(--danger-light), var(--danger));
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #D68910);
    color: white;
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--primary);
    background: var(--bg-card-hover);
}

.btn-lg {
    padding: var(--spacing-lg) var(--spacing-xl);
    font-size: 1.1rem;
}

.btn-sm {
    padding: var(--spacing-sm) var(--spacing-md);
    font-size: 0.85rem;
}

.btn-block {
    width: 100%;
}

.btn-icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: var(--spacing-lg);
    transition: all var(--transition-normal);
}

.card:hover {
    border-color: var(--border-light);
    box-shadow: var(--shadow-md);
}

/* Tables */
.table-container {
    overflow-x: auto;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: var(--spacing-md);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background: var(--bg-input);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
}

tr:hover td {
    background: var(--bg-card-hover);
}

tr:last-child td {
    border-bottom: none;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: var(--spacing-xs) var(--spacing-md);
    border-radius: var(--radius-xl);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-success {
    background: rgba(39, 174, 96, 0.2);
    color: var(--success-light);
}

.badge-warning {
    background: rgba(243, 156, 18, 0.2);
    color: var(--warning-light);
}

.badge-danger {
    background: rgba(231, 76, 60, 0.2);
    color: var(--danger-light);
}

.badge-info {
    background: rgba(52, 152, 219, 0.2);
    color: var(--info);
}

/* Form Groups */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-group label {
    display: block;
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
}

/* Grid Utilities */
.grid {
    display: grid;
    gap: var(--spacing-md);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Flex Utilities */
.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* CRÍTICO: Não bloquear cliques quando invisível */
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* CRÍTICO: Permitir cliques quando visível */
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9) translateY(20px);
    transition: all var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 1.5rem;
}

.modal-close {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--danger);
    color: white;
}

.modal-body {
    padding: var(--spacing-lg);
}

.modal-footer {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-lg);
    border-top: 1px solid var(--border-color);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: var(--spacing-2xl);
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 4rem;
    margin-bottom: var(--spacing-md);
    opacity: 0.5;
}

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

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-fadeIn {
    animation: fadeIn var(--transition-normal) ease;
}

.animate-slideUp {
    animation: slideUp var(--transition-normal) ease;
}

/* Responsive */
@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-4, .grid-3, .grid-2 {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .sidebar, .top-bar, .btn {
        display: none !important;
    }
    
    .main-content {
        margin: 0;
        padding: 0;
    }
}

/* ========================================
   MOBILE OVERRIDE - Garantir layout correto
   ======================================== */
@media (max-width: 768px) {
    .app-container {
        display: block !important;
        flex-direction: column !important;
    }
    
    .sidebar {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        min-width: 0 !important;
        max-width: 0 !important;
        height: 0 !important;
        flex: 0 !important;
        position: absolute !important;
        left: -9999px !important;
        pointer-events: none !important;
        z-index: -1 !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        padding-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        flex: 1 !important;
    }
}

/* ========================================
   CHECKBOX CUSTOMIZADO - PROFISSIONAL
   ======================================== */

/* Reset checkbox nativo */
input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    min-width: 22px;
    min-height: 22px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-input);
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    vertical-align: middle;
}

input[type="checkbox"]:hover {
    border-color: var(--primary);
    background: var(--bg-card-hover);
}

input[type="checkbox"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.2);
}

/* Checkbox marcado */
input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
}

/* Check mark - usando pseudo-elemento */
input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 7px;
    width: 5px;
    height: 10px;
    border: solid #FFFFFF;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg);
}

/* Checkbox grande para toggle */
input[type="checkbox"].toggle-checkbox {
    width: 50px;
    height: 28px;
    border-radius: 14px;
    background: var(--bg-input);
    border: 2px solid var(--border-color);
}

input[type="checkbox"].toggle-checkbox::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: all 0.3s ease;
}

input[type="checkbox"].toggle-checkbox:checked {
    background: var(--primary);
    border-color: var(--primary);
}

input[type="checkbox"].toggle-checkbox:checked::before {
    left: 24px;
    background: #FFFFFF;
}

input[type="checkbox"].toggle-checkbox::after {
    display: none;
}

/* Checkbox em lista de itens */
.comanda-item-check input[type="checkbox"] {
    width: 24px;
    height: 24px;
    min-width: 24px;
    min-height: 24px;
}

.comanda-item-check input[type="checkbox"]:checked::after {
    top: 4px;
    left: 8px;
    width: 6px;
    height: 12px;
}

/* Checkbox em permissões */
.permissao-item input[type="checkbox"],
.categoria-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    min-height: 20px;
    margin-right: 8px;
}

.permissao-item input[type="checkbox"]:checked::after,
.categoria-item input[type="checkbox"]:checked::after {
    top: 2px;
    left: 6px;
    width: 5px;
    height: 10px;
}

/* Labels com checkbox */
label:has(input[type="checkbox"]) {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 8px;
}

/* Disabled state */
input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

input[type="checkbox"]:disabled:checked {
    background: var(--text-muted);
    border-color: var(--text-muted);
}
