/* Estilos do sistema - Design Profissional */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Forçar detecção correta de dispositivos móveis */
html {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    width: 100%;
    overflow-x: hidden;
}

body {
    width: 100%;
    overflow-x: hidden;
    position: relative;
}

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary-color: #8b5cf6;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-white: #ffffff;
    --bg-gray: #f9fafb;
    --border-color: #e5e7eb;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Estilos específicos para página de login */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* Background animado */
.login-wrapper {
    width: 100%;
    min-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 0;
}

.login-background {
    position: absolute;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.background-pattern {
    position: absolute;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
}

/* Container de Login */
.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 60px 20px 40px 20px;
    box-sizing: border-box;
}

.login-box {
    background: var(--bg-white);
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    padding: 48px 40px;
    animation: slideUp 0.6s ease-out;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    width: 100%;
    max-width: 440px;
}

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

/* Header do Login */
.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 16px;
}

.logo-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    box-shadow: var(--shadow-lg);
}

.logo-icon i {
    font-size: 28px;
    color: white;
}

.login-header h1 {
    color: var(--text-primary);
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.welcome-text {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 12px;
}

/* Alertas */
.alert {
    padding: 14px 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert i {
    font-size: 18px;
    flex-shrink: 0;
}

.alert-error {
    background-color: #fef2f2;
    color: var(--error-color);
    border: 1px solid #fecaca;
}

.alert-success {
    background-color: #f0fdf4;
    color: var(--success-color);
    border: 1px solid #bbf7d0;
}

/* Formulário */
.login-form {
    margin-top: 8px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 14px;
}

.form-group label i {
    font-size: 14px;
    color: var(--text-secondary);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    color: var(--text-secondary);
    font-size: 16px;
    z-index: 1;
    pointer-events: none;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 14px 16px 14px 48px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: var(--bg-gray);
    color: var(--text-primary);
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-white);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group input[type="text"]::placeholder,
.form-group input[type="password"]::placeholder {
    color: var(--text-secondary);
}

.toggle-password {
    position: absolute;
    right: 16px;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s;
}

.toggle-password:hover {
    color: var(--primary-color);
}

.form-group-inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

/* Checkbox customizado */
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: normal;
    gap: 10px;
}

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

.checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    background: var(--bg-gray);
}

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

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '\2713';
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.checkbox-text {
    color: var(--text-primary);
    font-size: 14px;
}

.forgot-password-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s;
}

.forgot-password-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Botões */
.btn {
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-block {
    width: 100%;
}

.btn-text {
    position: relative;
    z-index: 1;
}

.btn-icon {
    position: relative;
    z-index: 1;
    transition: transform 0.3s;
}

.btn-primary:hover .btn-icon {
    transform: translateX(4px);
}

/* Footer do Login */
.login-footer {
    margin-top: 32px;
    text-align: center;
}

.divider {
    position: relative;
    margin: 24px 0;
    text-align: center;
}

.divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.divider span {
    position: relative;
    background: var(--bg-white);
    padding: 0 16px;
    color: var(--text-secondary);
    font-size: 13px;
}

.footer-text {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 16px;
}

.support-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.support-link:hover {
    text-decoration: underline;
}

.login-info {
    text-align: center;
    margin-top: 32px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 13px;
    width: 100%;
    max-width: 440px;
}

/* Dashboard */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 24px 32px;
    background: var(--bg-white);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.dashboard-header h1 {
    color: var(--text-primary);
    font-size: 28px;
    font-weight: 700;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-info span {
    color: var(--text-secondary);
    font-size: 14px;
}

.dashboard-content {
    background: var(--bg-white);
    padding: 32px;
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

/* Dashboard Styles - Base */
.dashboard-body {
    background: var(--bg-gray);
    min-height: 100vh;
    overflow-x: hidden;
}

.main-navbar {
    background: var(--bg-white);
    box-shadow: var(--shadow-sm);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.brand-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.3s;
}

.navbar-user:hover {
    background: var(--bg-gray);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.user-role {
    font-size: 12px;
    color: var(--text-secondary);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-white);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s;
}

.navbar-user:hover .user-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: var(--text-primary);
    text-decoration: none;
    transition: background 0.3s;
    border-radius: 8px;
}

.dropdown-item:hover {
    background: var(--bg-gray);
}

.dropdown-item i {
    color: var(--error-color);
    width: 18px;
}

/* Main Content - Base */
.main-content {
    flex: 1;
    padding: 32px 24px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

/* Garantir que containers não ultrapassem a largura da tela */
.main-wrapper,
.dashboard-layout,
.dashboard-body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* Regra global para todos os containers de páginas em mobile */
@media screen and (max-width: 768px) {
    [class*="-container"],
    [class*="-wrapper"] {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
}

@media screen and (max-width: 480px) {
    [class*="-container"],
    [class*="-wrapper"] {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
}

/* Modais - Estilos Globais */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

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

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 800px;
    max-height: 90vh;
    margin: auto;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.3s;
    line-height: 1;
}

.modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-actions {
    padding: 16px 24px;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    flex-shrink: 0;
    background: #f8f9fa;
}

/* Cards e Tabelas Responsivos */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 24px;
    overflow: hidden;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.card-body {
    padding: 24px;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    min-width: 600px;
}

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    background: #f8f9fa;
    border-bottom: 2px solid #e0e0e0;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

/* Formulários Responsivos */
.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #2c3e50;
    font-size: 14px;
}

/* Detecção de dispositivos móveis - aplicar imediatamente */
@media screen and (max-width: 768px) {
    html {
        font-size: 14px;
    }
    
    body {
        font-size: 14px;
    }
    
    .main-content {
        padding: 16px 12px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .container {
        padding: 16px 12px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Forçar largura total em todos os containers */
    .comissoes-container,
    .vendas-container,
    .produtos-container,
    .usuarios-container,
    .clientes-container,
    .mesas-container,
    .caixa-container,
    .relatorios-container,
    .contas-receber-container,
    .configuracoes-container,
    .auditoria-estoque-container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 16px 12px !important;
        box-sizing: border-box !important;
    }
}

/* Responsivo - Base */
@media (max-width: 768px) {
    .main-content {
        padding: 24px 16px;
    }
    
    .container {
        padding: 16px;
    }
    
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 20px;
    }
    
    .navbar-container {
        padding: 0 16px;
        height: 60px;
    }
    
    .user-details {
        display: none;
    }
    
    /* Modais Responsivos */
    .modal {
        padding: 10px;
        align-items: center;
    }
    
    .modal-content {
        max-width: 100%;
        max-height: 95vh;
        margin: 0;
        border-radius: 8px;
    }
    
    .modal-header {
        padding: 16px 20px;
        flex-wrap: wrap;
    }
    
    .modal-header h3 {
        font-size: 18px;
        flex: 1;
        min-width: 0;
    }
    
    .modal-body {
        padding: 16px 20px;
    }
    
    .modal-actions {
        padding: 12px 20px;
        flex-direction: column;
    }
    
    .modal-actions .btn {
        width: 100%;
    }
    
    /* Tabelas Responsivas */
    .table-responsive {
        margin: 0 -20px;
        padding: 0 20px;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 6px;
    }
    
    /* Cards Responsivos */
    .card-header {
        padding: 16px 20px;
    }
    
    .card-body {
        padding: 16px 20px;
    }
}

@media screen and (max-width: 480px) {
    html {
        font-size: 14px;
    }
    
    body {
        font-size: 14px;
    }
    
    /* Forçar largura total e padding mínimo em mobile */
    .main-content {
        padding: 12px 8px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    .container {
        padding: 12px 8px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Todos os containers principais */
    .comissoes-container,
    .vendas-container,
    .produtos-container,
    .usuarios-container,
    .clientes-container,
    .mesas-container,
    .caixa-container,
    .relatorios-container,
    .contas-receber-container,
    .configuracoes-container,
    .auditoria-estoque-container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 12px 8px !important;
        box-sizing: border-box !important;
    }
    
    .login-container {
        padding: 40px 15px 30px 15px;
    }
    
    .login-box {
        padding: 32px 24px;
    }
    
    .login-header h1 {
        font-size: 28px;
    }
    
    .logo-icon {
        width: 56px;
        height: 56px;
    }
    
    .logo-icon i {
        font-size: 24px;
    }
    
    .form-group-inline {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .login-info {
        margin-top: 24px;
    }
    
    /* Menu Mobile */
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-wrapper {
        margin-left: 0;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .header-title h1 {
        font-size: 20px;
    }
    
    /* Modais Mobile */
    .modal {
        padding: 0;
        align-items: stretch;
    }
    
    .modal-content {
        max-height: 100vh;
        border-radius: 0;
        height: 100vh;
        display: flex;
        flex-direction: column;
    }
    
    .modal-header {
        padding: 12px 16px;
    }
    
    .modal-header h3 {
        font-size: 16px;
    }
    
    .modal-body {
        padding: 12px 16px;
        flex: 1;
        overflow-y: auto;
    }
    
    .modal-actions {
        padding: 12px 16px;
    }
    
    /* Tabelas Mobile */
    .data-table {
        font-size: 11px;
        min-width: 500px;
    }
    
    .data-table th,
    .data-table td {
        padding: 6px 4px;
    }
    
    /* Formulários Mobile */
    .form-control {
        padding: 10px 12px;
        font-size: 16px; /* Evita zoom no iOS */
    }
    
    .form-group {
        margin-bottom: 16px;
    }
    
    .form-group label {
        font-size: 13px;
    }
}

/* Loading state */
.btn-primary.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn-primary.loading .btn-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
