/* Reset e Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #1a5fb4;
    --secondary: #c01c28;
    --success: #26a269;
    --warning: #e5a50a;
    --danger: #c01c28;
    --light: #f8f9fa;
    --dark: #2c3e50;
    --gray: #6c757d;
    --border: #dee2e6;
    --card-bg: #ffffff;
    --sidebar-bg: #2c3e50;
    --shadow: rgba(0, 0, 0, 0.1);
    --radius: 8px;
}

body {
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--dark);
    background: var(--light);
    -webkit-tap-highlight-color: transparent;
}

/* Telas */
.screen {
    display: none;
    min-height: 100vh;
    width: 100%;
}

.screen.active {
    display: block;
}

/* Login */
.login-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.logo-gif-container {
    width: 120px;
    height: 120px;
    margin: 0 auto 20px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid white;
    background: white;
}

.logo-gif-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.logo-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 5px;
}

.logo-subtitle {
    font-size: 14px;
    opacity: 0.9;
}

.login-form {
    background: white;
    padding: 25px;
    border-radius: var(--radius);
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 16px;
    transition: all 0.3s;
    background: white;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 95, 180, 0.1);
}

/* Botões */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--radius);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: #0d4a9c;
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-warning {
    background: var(--warning);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-sm {
    padding: 8px 15px;
    font-size: 14px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--dark);
    font-size: 18px;
    cursor: pointer;
}

.btn-login {
    width: 100%;
    margin-top: 10px;
}

/* Dashboard */
.mobile-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 15px;
    box-shadow: 0 2px 10px var(--shadow);
    z-index: 1000;
}

.header-title {
    flex: 1;
    text-align: center;
}

.header-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.header-logo img {
    width: 30px;
    height: 30px;
    border-radius: 5px;
}

.header-logo span {
    font-weight: 600;
    color: var(--primary);
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: var(--sidebar-bg);
    color: white;
    transition: left 0.3s ease;
    z-index: 1001;
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.user-details {
    flex: 1;
}

.user-email {
    display: block;
    font-size: 14px;
    font-weight: 500;
}

.user-status {
    font-size: 12px;
    opacity: 0.8;
}

.sidebar-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
}

.sidebar-menu {
    flex: 1;
    list-style: none;
    padding: 15px 0;
    overflow-y: auto;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.3s;
    border-left: 4px solid transparent;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background: rgba(255,255,255,0.1);
    color: white;
    border-left-color: var(--primary);
}

.sidebar-menu i {
    width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.pix-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    opacity: 0.9;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
}

.sidebar-overlay.show {
    display: block;
}

/* Conteúdo Principal */
.main-content {
    margin-top: 60px;
    padding: 20px;
    min-height: calc(100vh - 60px);
}

.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-header h2 {
    font-size: 20px;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px var(--shadow);
    border: 1px solid var(--border);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.card-header h3 {
    font-size: 16px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    box-shadow: 0 2px 10px var(--shadow);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: white;
}

.stat-icon.total { background: var(--primary); }
.stat-icon.paid { background: var(--success); }
.stat-icon.overdue { background: var(--danger); }

.stat-info h3 {
    font-size: 24px;
    margin-bottom: 5px;
}

.stat-info p {
    font-size: 12px;
    color: var(--gray);
}

/* PIX Banner */
.pix-banner {
    background: linear-gradient(135deg, #32CD32 0%, #228B22 100%);
    color: white;
    padding: 15px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.pix-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.pix-content i {
    font-size: 24px;
}

.pix-content h4 {
    font-size: 14px;
    margin-bottom: 5px;
}

.pix-content p {
    font-size: 12px;
    opacity: 0.9;
    word-break: break-all;
}

/* Tabelas */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

th {
    background: var(--light);
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: var(--dark);
    border-bottom: 2px solid var(--border);
    font-size: 12px;
    white-space: nowrap;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

tr:hover {
    background: rgba(26, 95, 180, 0.05);
}

/* Formulários */
.client-form {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
}

.form-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.form-section h4 {
    font-size: 16px;
    color: var(--primary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* Filtros */
.filters-container {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 15px;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-input,
.filter-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
}

/* Importação */
.import-instructions {
    margin-bottom: 20px;
}

.import-instructions pre {
    background: var(--light);
    padding: 15px;
    border-radius: var(--radius);
    font-size: 12px;
    overflow-x: auto;
    margin-top: 10px;
}

.file-drop-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    margin-bottom: 20px;
}

.file-drop-area:hover {
    border-color: var(--primary);
    background: rgba(26, 95, 180, 0.05);
}

.file-drop-area i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 15px;
}

.preview-container {
    margin-top: 20px;
}

.preview-table {
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: 15px;
}

.preview-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Exportação */
.export-options {
    text-align: center;
}

.export-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-top: 15px;
}

.btn-export {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 15px 10px;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s;
}

.btn-export:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-export i {
    font-size: 24px;
}

/* Alertas e Avisos */
.warning-alert {
    background: rgba(229, 165, 10, 0.1);
    border: 1px solid rgba(229, 165, 10, 0.3);
    border-radius: var(--radius);
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    color: var(--warning);
}

.warning-alert i {
    font-size: 20px;
}

.settings-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* Modais */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalFade 0.3s ease;
}

@keyframes modalFade {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--gray);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Toasts */
#toastContainer {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1200;
}

.toast {
    background: var(--primary);
    color: white;
    padding: 12px 20px;
    border-radius: var(--radius);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastSlide 0.3s ease;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

@keyframes toastSlide {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

/* Utilitários */
.text-muted {
    color: var(--gray);
    font-size: 12px;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-bbc {
    background: rgba(26, 95, 180, 0.1);
    color: var(--primary);
    border: 1px solid rgba(26, 95, 180, 0.3);
}

.badge-btmob {
    background: rgba(192, 28, 40, 0.1);
    color: var(--secondary);
    border: 1px solid rgba(192, 28, 40, 0.3);
}

.badge-both {
    background: rgba(38, 162, 105, 0.1);
    color: var(--success);
    border: 1px solid rgba(38, 162, 105, 0.3);
}

.status-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.status-paid {
    background: rgba(38, 162, 105, 0.1);
    color: var(--success);
}

.status-overdue {
    background: rgba(192, 28, 40, 0.1);
    color: var(--danger);
}

.status-pending {
    background: rgba(229, 165, 10, 0.1);
    color: var(--warning);
}

/* Responsividade */
@media (max-width: 768px) {
    .login-form {
        padding: 20px;
    }
    
    .logo-gif-container {
        width: 100px;
        height: 100px;
    }
    
    .logo-title {
        font-size: 24px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .filters-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    .modal-content {
        width: 95%;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .export-buttons {
        grid-template-columns: 1fr 1fr;
    }
    
    .settings-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}

/* Touch Optimization */
@media (hover: none) {
    .btn:hover,
    .sidebar-menu li a:hover {
        transform: none;
    }
    
    input,
    select,
    textarea {
        font-size: 16px; /* Previne zoom no iOS */
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    :root {
        --light: #1a1a1a;
        --dark: #f8f9fa;
        --card-bg: #2d2d2d;
        --border: #404040;
        --gray: #a0a0a0;
    }
    
    body {
        background: var(--light);
        color: var(--dark);
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        background: #3d3d3d;
        color: white;
        border-color: #505050;
    }
    
    .login-form {
        background: #2d2d2d;
        color: white;
    }
    
    .form-group label {
        color: white;
    }
    
    th {
        background: #3d3d3d;
    }
}