/* Reset e configurações gerais */
html, body { 
    height: 100%; 
    margin: 0; 
    padding: 0;
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: inherit;
}

body {
    font-family: Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    min-height: 100vh;
}

/* Backgrounds específicos por role */
body.bg-admin-alert { 
    background: linear-gradient(90deg, #DE4E69, #6C5DB5) !important; 
}

body.bg-operator { 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important; 
}

/* Topbar unificada */
.topbar {
    display: flex; 
    gap: 0.5rem; 
    align-items: center; 
    justify-content: space-between;
    padding: 0.75rem 1rem; 
    margin: 0 1rem; 
    border-radius: 14px;
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(6px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
}

.topbar .left, .topbar .right { 
    display: flex; 
    gap: 0.5rem; 
    align-items: center; 
}

.topbar .app-title { 
    color: #fff; 
    font-weight: 900; 
    letter-spacing: 0.3px; 
}

/* Sistema de botões unificado */
.btn-white {
    display: inline-block;
    padding: 0.8rem 1.1rem;
    border-radius: 14px;
    background: #fff !important;
    color: #333 !important;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    transition: transform 0.15s ease;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
}

.btn-white:hover { 
    transform: translateY(-2px); 
    text-decoration: none;
    color: #333 !important;
}

.btn-primary {
    display: inline-block;
    padding: 0.8rem 1.2rem;
    border-radius: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff !important;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    transition: transform 0.15s ease;
    border: none;
    cursor: pointer;
}

.btn-primary:hover { 
    transform: translateY(-2px); 
    text-decoration: none;
    color: #fff !important;
}

.btn-success {
    display: inline-block;
    padding: 0.9rem 1.2rem;
    border-radius: 10px;
    background: #22c55e;
    color: #fff !important;
    font-weight: 800;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.btn-success:hover { 
    transform: translateY(-2px); 
    text-decoration: none;
    color: #fff !important;
}

.btn-danger {
    display: inline-block;
    padding: 0.9rem 1.2rem;
    border-radius: 10px;
    background: #dc3545;
    color: #fff !important;
    font-weight: 800;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.btn-danger:hover { 
    transform: translateY(-2px); 
    text-decoration: none;
    color: #fff !important;
}

.btn-secondary {
    display: inline-block;
    padding: 0.8rem 1.2rem;
    border-radius: 10px;
    background: #6c757d;
    color: #fff !important;
    font-weight: 700;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: transform 0.15s ease;
}

.btn-secondary:hover { 
    transform: translateY(-2px); 
    text-decoration: none;
    color: #fff !important;
}

/* Títulos padronizados */
.page-title {
    text-align: center;
    color: #fff;
    font-weight: 800;
    margin: 16px 0 24px;
    font-size: 1.8rem;
}

.subtitle {
    color: #fff;
    margin-bottom: 1rem;
    text-align: center;
    opacity: 0.9;
}

/* Cards padronizados */
.card-surface {
    background: #3c3f44;
    border-radius: 20px;
    padding: 18px;
    margin: 0 1.2rem 2rem;
    box-shadow: 0 12px 36px rgba(0,0,0,0.25);
}

.card {
    background: #fff;
    border-radius: 10px;
    padding: 1rem;
    box-shadow: 0 8px 20px rgba(0,0,0,0.07);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Grids padronizados */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1rem;
    margin: 1rem;
}

.grid-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin: 2rem 1rem;
}

/* Controles de produto */
.product-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 0.5rem;
}

.product-stock {
    color: #555;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.control-btn {
    flex: 0 0 48px;
    height: 40px;
    border: none;
    border-radius: 6px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.15s ease;
}

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

.btn-plus {
    background: #007bff;
    color: #fff;
}

.btn-minus {
    background: #dc3545;
    color: #fff;
}

.count-display {
    min-width: 48px;
    text-align: center;
    font-size: 1rem;
    font-weight: bold;
    background: #ff4d4f;
    color: #fff;
    border-radius: 6px;
    padding: 0.2rem 0.4rem;
    display: none; /* Só aparece quando > 0 */
    flex-shrink: 0;
}

.count-input {
    min-width: 64px;
    text-align: center;
    font-size: 1.1rem;
    font-weight: bold;
    background: #f1f3f5;
    color: #000;
    border-radius: 6px;
    padding: 0.3rem 0.6rem;
    border: 1px solid #ddd;
}

/* Toolbars */
.toolbar {
    display: flex;
    gap: 0.5rem;
    margin: 1rem;
    justify-content: space-between;
    align-items: center;
}

.toolbar-center {
    justify-content: center;
}

/* Formulários */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #333;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* Login específico */
.login-container {
    background: #fff;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    color: #333;
    margin-bottom: 0.5rem;
}

.login-header p {
    color: #666;
    font-size: 0.9rem;
}

/* Mensagens */
.message {
    padding: 0.75rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    text-align: center;
}

.error-message {
    background: #ff4757;
    color: #fff;
}

.success-message {
    background: #2ed573;
    color: #fff;
}

/* Utilitários */
.text-center { text-align: center; }
.text-white { color: #fff; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.p-1 { padding: 1rem; }

/* Responsividade */
@media (max-width: 768px) {
    .topbar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .grid {
        grid-template-columns: 1fr;
        margin: 1rem 0.5rem;
    }
    
    .toolbar {
        flex-direction: column;
        gap: 1rem;
    }
}

/* ===== SISTEMA DE MODALS ===== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: #fff;
    border-radius: 20px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalAppear 0.3s ease-out;
}

.modal-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    color: #333;
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
}

.modal-body {
    margin-bottom: 1.5rem;
    padding: 0 0.5rem;
}

.modal-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.5rem;
    border-bottom: 1px solid #eee;
    gap: 1rem;
}

.modal-item:last-child {
    border-bottom: none;
}

.modal-item .item-name {
    font-weight: bold;
    color: #333;
}

.modal-item .item-quantity {
    color: #ff6b6b;
    font-weight: bold;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* Animação de aparição */
@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Esconder modal por padrão */
.modal-hidden {
    display: none;
}