/* ============================================
   TEMA DARK PROFISSIONAL - SISTEMA LOJA ROUPAS
   Desenvolvido por L. Fernando - Versão 1.0.0-2026
   ============================================ */

:root {
    /* Cores principais - Dark Theme */
    --bg-primary: #0f1419;
    --bg-secondary: #1a1f2e;
    --bg-tertiary: #252b3b;
    --bg-card: #1e2532;
    --bg-hover: #2a3142;
    
    /* Cores de texto */
    --text-primary: #e4e6eb;
    --text-secondary: #b0b3b8;
    --text-muted: #8a8d91;
    
    /* Cores de destaque */
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    /* Bordas e sombras */
    --border-color: #2d3441;
    --border-hover: #3d4454;
    --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-xl: 0 20px 60px rgba(0, 0, 0, 0.6);
    
    /* Gradientes */
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    
    /* Transições */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

/* ============================================
   HEADER E NAVEGAÇÃO
   ============================================ */

.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 1000;
    backdrop-filter: blur(10px);
}

.header-content {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.logo {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    padding: 18px 0;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.main-nav {
    display: flex;
    gap: 0;
    flex-wrap: wrap;
    flex: 1;
    justify-content: center;
    padding: 0 20px;
}

.nav-item {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 18px 24px;
    display: inline-block;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    font-weight: 500;
    font-size: 14px;
    position: relative;
}

.nav-item::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: var(--gradient-primary);
    transition: var(--transition);
}

.nav-item:hover {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.1);
}

.nav-item:hover::before {
    width: 80%;
}

.nav-item.active {
    color: var(--primary);
    background: rgba(99, 102, 241, 0.15);
}

.nav-item.active::before {
    width: 100%;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 0;
}

.user-info span {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
}

.btn-logout {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
    font-size: 13px;
    box-shadow: var(--shadow-sm);
}

.btn-logout:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ============================================
   CONTEÚDO PRINCIPAL
   ============================================ */

.main-content {
    max-width: 1600px;
    margin: 0 auto;
    padding: 32px 24px;
    min-height: calc(100vh - 80px);
}

.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 16px;
}

h1 {
    font-size: 32px;
    margin-bottom: 24px;
}

h2 {
    font-size: 24px;
    margin-bottom: 20px;
}

h3 {
    font-size: 20px;
    margin-bottom: 16px;
}

/* ============================================
   TELA DE LOGIN
   ============================================ */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f1419 0%, #1a1f2e 50%, #252b3b 100%);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.login-container {
    max-width: 440px;
    width: 100%;
    background: var(--bg-card);
    padding: 48px 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    position: relative;
    z-index: 1;
    border: 1px solid var(--border-color);
    animation: slideUp 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 40px;
}

.login-logo {
    margin-bottom: 24px;
    display: flex;
    justify-content: center;
}

.login-logo svg {
    filter: drop-shadow(0 4px 12px rgba(99, 102, 241, 0.4));
}

.login-container h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    letter-spacing: -0.5px;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin: 0;
    font-weight: 400;
}

.login-form {
    margin-bottom: 28px;
}

.login-form .form-group {
    margin-bottom: 24px;
}

.login-form .form-group label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.login-form .form-group label svg {
    color: var(--text-secondary);
    width: 18px;
    height: 18px;
}

.login-form input[type="email"],
.login-form input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    transition: var(--transition);
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.login-form input[type="email"]:focus,
.login-form input[type="password"]:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.login-form input[type="email"]::placeholder,
.login-form input[type="password"]::placeholder {
    color: var(--text-muted);
}

.btn-login {
    width: 100%;
    padding: 16px;
    background: var(--gradient-primary);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.4);
    position: relative;
    overflow: hidden;
}

.btn-login::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-login:hover::before {
    left: 100%;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.5);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-login .btn-icon {
    transition: var(--transition);
}

.btn-login:hover .btn-icon {
    transform: translateX(4px);
}

.login-footer {
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.version-info {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 0 10px 0;
    font-weight: 500;
}

.author-info {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0 0 10px 0;
}

.author-info strong {
    color: var(--primary);
    font-weight: 600;
}

.copyright {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0;
}

#loginError {
    margin-bottom: 20px;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: shake 0.5s ease-in-out;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

#loginError::before {
    content: '⚠';
    font-size: 20px;
}

/* ============================================
   FORMULÁRIOS
   ============================================ */

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.form-control,
input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
select,
textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 14px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transition: var(--transition);
    font-family: inherit;
}

.form-control:focus,
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.form-control::placeholder,
input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23b0b3b8' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.form-row .form-group {
    margin-bottom: 0;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   BOTÕES
   ============================================ */

.btn-primary,
.btn-success,
.btn-danger,
.btn-secondary,
.btn-warning,
.btn-info {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow-sm);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--gradient-success);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: var(--gradient-danger);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    border-color: var(--border-hover);
}

.btn-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.btn-block {
    width: 100%;
    justify-content: center;
    margin-top: 10px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
    border-radius: 8px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ============================================
   CARDS E DASHBOARD
   ============================================ */

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

.card {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient-primary);
    transform: scaleY(0);
    transition: var(--transition);
}

.card:hover::before {
    transform: scaleY(1);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--border-hover);
}

.card h3 {
    margin-bottom: 12px;
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.card p {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.card .icon {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

/* ============================================
   TABELAS
   ============================================ */

.table-container {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    margin-top: 24px;
    overflow-x: auto;
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
}

table th,
table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: sticky;
    top: 0;
    z-index: 10;
}

table tr {
    transition: var(--transition);
}

table tr:hover {
    background: var(--bg-hover);
}

table tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================
   PDV
   ============================================ */

.pdv-container {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 24px;
    margin-top: 24px;
}

.pdv-left {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
}

.pdv-right {
    background: var(--bg-card);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    position: sticky;
    top: 100px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
}

.pdv-right::-webkit-scrollbar {
    width: 8px;
}

.pdv-right::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.pdv-right::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.pdv-right::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.search-bar input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 15px;
}

.search-bar input:focus {
    border-color: var(--primary);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
}

.produtos-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.produto-item {
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: var(--transition);
    background: var(--bg-tertiary);
}

.produto-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    background: var(--bg-secondary);
}

.produto-item h4 {
    margin-bottom: 6px;
    color: var(--text-primary);
    font-size: 15px;
    font-weight: 600;
}

.produto-item .codigo {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.produto-item .preco {
    font-size: 20px;
    font-weight: 700;
    color: var(--success);
    margin-top: 8px;
}

.produto-item .estoque {
    font-size: 12px;
    color: var(--danger);
    margin-top: 6px;
    font-weight: 500;
}

.carrinho-items {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
}

.carrinho-items::-webkit-scrollbar {
    width: 6px;
}

.carrinho-items::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.carrinho-items::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.carrinho-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.carrinho-item:hover {
    background: var(--bg-hover);
}

.carrinho-item:last-child {
    border-bottom: none;
}

.carrinho-item-info {
    flex: 1;
}

.carrinho-item-info h4 {
    font-size: 14px;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-weight: 600;
}

.carrinho-item-info .preco {
    font-size: 12px;
    color: var(--text-secondary);
}

.carrinho-item-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.carrinho-item-actions input {
    width: 70px;
    text-align: center;
    padding: 8px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.carrinho-total {
    border-top: 2px solid var(--border-color);
    padding-top: 20px;
    margin-top: 20px;
}

.carrinho-total p {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    color: var(--text-primary);
    font-size: 15px;
}

.carrinho-total p strong {
    font-weight: 700;
    font-size: 18px;
    color: var(--primary);
}

.carrinho-total input {
    width: 120px;
    padding: 10px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* ============================================
   MODAIS
   ============================================ */

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: var(--bg-card);
    padding: 32px;
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-color);
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modal de compra - maior e melhor layout */
#modalCompra .modal-content {
    max-width: 98%;
    width: 98%;
    max-height: 96vh;
    padding: 40px 50px;
}

@media (min-width: 1200px) {
    #modalCompra .modal-content {
        max-width: 1400px;
        width: 1400px;
    }
}

@media (min-width: 1600px) {
    #modalCompra .modal-content {
        max-width: 1800px;
        width: 1800px;
    }
}

/* Modal de funcionário - layout otimizado em duas colunas */
#modalFuncionario .modal-content {
    max-width: 95%;
    width: 95%;
    max-height: 95vh;
    padding: 0;
}

@media (min-width: 1024px) {
    #modalFuncionario .modal-content {
        max-width: 1100px;
        width: 1100px;
    }
}

@media (min-width: 1400px) {
    #modalFuncionario .modal-content {
        max-width: 1300px;
        width: 1300px;
    }
}

@media (max-width: 1023px) {
    #modalFuncionario .modal-body > form > div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
}

/* Modal de forma de pagamento da venda */
#modalFormaPagamentoVenda .modal-content {
    max-width: 90%;
    width: 90%;
    max-height: 95vh;
    padding: 0;
}

@media (min-width: 768px) {
    #modalFormaPagamentoVenda .modal-content {
        max-width: 800px;
        width: 800px;
    }
}

@media (min-width: 1024px) {
    #modalFormaPagamentoVenda .modal-content {
        max-width: 900px;
        width: 900px;
    }
}

/* Layout em duas colunas para modal de compra */
.compra-modal-body {
    padding: 0 !important;
}

.compra-layout-duas-colunas {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
    align-items: start;
}

.compra-coluna-esquerda {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0; /* Permite que coluna encolha */
}

.compra-coluna-direita {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 20px;
    align-self: start;
}

@media (max-width: 1400px) {
    .compra-layout-duas-colunas {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .compra-coluna-direita {
        order: -1; /* Coloca resumo financeiro antes em telas menores */
        position: relative !important;
        top: 0 !important;
    }
    
    .compra-resumo-total {
        position: relative !important;
    }
}

/* Melhorias no modal de compra */
.compra-form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    background: var(--bg-card) !important;
}

.compra-form-actions button {
    min-width: 180px;
}

.compra-modal-body h3 {
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
    margin: 25px 0 18px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
}

.compra-modal-body h3:first-child {
    margin-top: 0;
}

.modal-content::-webkit-scrollbar {
    width: 8px;
}

.modal-content::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
    color: var(--text-primary);
}

.close-modal {
    background: none;
    border: none;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: var(--transition);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.close-modal:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

/* ============================================
   ALERTAS
   ============================================ */

.alert {
    padding: 16px 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: #fcd34d;
}

/* ============================================
   LOADING E SPINNER
   ============================================ */

.loading {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    border: 4px solid var(--bg-tertiary);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   BADGES
   ============================================ */

.badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-primary {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.3);
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        padding: 12px;
    }

    .main-nav {
        width: 100%;
        overflow-x: auto;
        justify-content: flex-start;
        padding: 0;
        margin-top: 12px;
    }

    .main-nav::-webkit-scrollbar {
        height: 4px;
    }

    .main-nav::-webkit-scrollbar-track {
        background: var(--bg-tertiary);
    }

    .main-nav::-webkit-scrollbar-thumb {
        background: var(--border-color);
        border-radius: 2px;
    }

    .nav-item {
        padding: 14px 18px;
        font-size: 13px;
    }

    .main-content {
        padding: 20px 16px;
    }

    .pdv-container {
        grid-template-columns: 1fr;
    }

    .pdv-right {
        position: relative;
        top: 0;
        max-height: none;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .modal-content {
        padding: 24px;
        margin: 20px;
    }
}

/* ============================================
   UTILITÁRIOS
   ============================================ */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.d-flex {
    display: flex;
}

.align-items-center {
    align-items: center;
}

.justify-content-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 16px;
}

/* Scrollbar personalizada para todo o site */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-hover);
}

/* ============================================
   ESTILOS ESPECÍFICOS PARA MODAL DE COMPRA
   ============================================ */

#compraItensList table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

#compraItensList table thead th {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 13px;
    padding: 10px 8px;
    text-align: left;
    border-bottom: 2px solid var(--border-color);
}

#compraItensList table tbody td {
    padding: 10px 8px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 14px;
}

#compraItensList table tbody tr:hover {
    background: var(--bg-hover);
}

#compraItensList table tbody tr:last-child td {
    border-bottom: none;
}

.modal-body h3 {
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    margin: 24px 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--border-color);
}

.modal-body h3:first-child {
    margin-top: 0;
}

/* Estilos para seleção de dízimos */
.dizimo-pendente:hover {
    background-color: var(--bg-hover) !important;
}

.checkbox-dizimo {
    accent-color: var(--warning);
    cursor: pointer;
    width: 20px;
    height: 20px;
}

.checkbox-dizimo:checked {
    accent-color: var(--success);
}

/* Destaque visual para linhas selecionadas */
tr.dizimo-selecionado {
    background-color: rgba(245, 158, 11, 0.15) !important;
    border-left: 4px solid var(--warning) !important;
}

tr.dizimo-selecionado:hover {
    background-color: rgba(245, 158, 11, 0.25) !important;
}

tr.dizimo-pendente:hover {
    background-color: var(--bg-hover);
}

/* ============================================
   ESTILOS PARA MODAL DE COMPRA
   ============================================ */

.compra-itens-container {
    margin: 20px 0;
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 8px;
    max-height: 400px;
    overflow-y: auto;
    background: var(--bg-secondary);
}

.compra-itens-header {
    display: flex;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 6px;
    margin-bottom: 10px;
    border-bottom: 2px solid var(--border-color);
    font-size: 13px;
}

.compra-item-row {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--bg-card);
    border-radius: 6px;
    margin-bottom: 8px;
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.compra-item-row:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    transform: translateX(2px);
}

.compra-item-input {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 5px;
    color: var(--text-primary);
    font-size: 14px;
    transition: var(--transition);
}

.compra-item-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-secondary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.compra-resumo-total {
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.compra-resumo-linha {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 14px;
}

.compra-resumo-linha:last-of-type {
    border-bottom: none;
}

.compra-resumo-desconto {
    color: var(--danger);
}

.compra-resumo-total-final {
    display: flex;
    justify-content: space-between;
    font-size: 20px;
    font-weight: bold;
    padding-top: 15px;
    margin-top: 15px;
    border-top: 3px solid var(--primary);
    color: var(--text-primary);
}

.compra-resumo-total-final strong {
    color: var(--success);
    font-size: 24px;
}

.produto-item-lista:hover {
    background: var(--bg-hover) !important;
    cursor: pointer;
}

/* Botão de novo produto */
.btn-info {
    background: var(--info);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-info:hover {
    background: #2563eb;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Estilo para lista de produtos na busca */
#compraListaProdutos {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
}

#compraListaProdutos .produto-item-lista {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

#compraListaProdutos .produto-item-lista:last-child {
    border-bottom: none;
}

#compraListaProdutos .produto-item-lista:hover {
    background: var(--bg-hover);
}

/* Alert info */
.alert-info {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: var(--info);
    padding: 12px;
    border-radius: 6px;
    font-size: 13px;
}

/* ============================================
   ESTILOS PARA ESTOQUE
   ============================================ */

.estoque-row {
    transition: var(--transition);
}

.estoque-row:hover {
    background: var(--bg-hover) !important;
    transform: translateX(2px);
}

.btn-success.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    margin: 0 2px;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-success.active {
    background: #047857;
}

/* Botões de ações de estoque */
button[onclick*="ajustarEstoque"],
button[onclick*="verHistoricoEstoque"] {
    margin: 0 2px;
    min-width: 40px;
}
