/* ============================================
   SISTEMA DE COBRANÇA - CSS CENTRALIZADO
   CORES TIO SNOOP
   #1a1a2e (azul escuro)
   #16213e (azul marinho)
   #0f3460 (azul médio)
   #e94560 (vermelho/coral)
   #ffd700 (dourado)
   ============================================ */

/* ---------- RESET E BASE ---------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: #f0f2f5;
    color: #333;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
    width: 100%;
}

/* ---------- HEADER ---------- */
.header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: white;
    padding: 15px 0;
    box-shadow: 0 2px 20px rgba(0,0,0,0.3);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid #e94560;
}

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

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    font-size: 1.8rem;
    color: #ffd700;
}

.logo span {
    color: white;
}

.logo span span {
    color: #e94560;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
}

.nav-menu ul {
    display: flex;
    list-style: none;
    gap: 20px;
    margin: 0;
    padding: 0;
}

.nav-menu a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
}

.nav-menu a:hover {
    background: rgba(233, 69, 96, 0.2);
    color: #ffd700;
    transform: translateY(-1px);
}

.nav-menu a.active {
    background: rgba(233, 69, 96, 0.25);
    color: #ffd700;
    border-left: 3px solid #e94560;
}

.nav-menu a i {
    font-size: 1.1rem;
}

/* ---------- MAIN CONTENT ---------- */
.main-content {
    flex: 1;
    padding: 30px 0;
}

/* ---------- CARDS ---------- */
.card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    border: 1px solid rgba(0,0,0,0.03);
}

.card-title {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: #1a1a2e;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.card-title i {
    color: #e94560;
}

.card-title .btn-primary {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: none;
    color: white;
}

.card-title .btn-primary:hover {
    background: linear-gradient(135deg, #2a2a4e 0%, #1a1a2e 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(26, 26, 46, 0.3);
}

.card-title .btn-success {
    background: linear-gradient(135deg, #e94560 0%, #c0392b 100%);
    border: none;
    color: white;
}

.card-title .btn-success:hover {
    background: linear-gradient(135deg, #ff6b81 0%, #e94560 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(233, 69, 96, 0.3);
}

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

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #1a1a2e;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

.form-control:focus {
    outline: none;
    border-color: #e94560;
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.15);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e94560' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1em;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-control:disabled {
    background: #e9ecef;
    cursor: not-allowed;
}

/* ---------- BUTTONS ---------- */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    font-weight: 500;
}

.btn-primary {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2a2a4e 0%, #1a1a2e 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(26, 26, 46, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, #e94560 0%, #c0392b 100%);
    color: white;
    border: none;
}

.btn-success:hover {
    background: linear-gradient(135deg, #ff6b81 0%, #e94560 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(233, 69, 96, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #e94560 0%, #c0392b 100%);
    color: white;
    border: none;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #ff6b81 0%, #e94560 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(233, 69, 96, 0.3);
}

.btn-whatsapp {
    background: #25D366;
    color: white;
    border: none;
}

.btn-whatsapp:hover {
    background: #1da851;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(37, 211, 102, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, #ffd700 0%, #f5a623 100%);
    color: #1a1a2e;
    border: none;
}

.btn-warning:hover {
    background: linear-gradient(135deg, #ffe44d 0%, #ffd700 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.4);
}

.btn-sm {
    padding: 5px 10px;
    font-size: 0.85rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

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

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

table thead {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: white;
}

table thead th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    border-bottom: none;
}

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

table tbody tr:hover {
    background: rgba(233, 69, 96, 0.05);
}

/* ---------- BADGES ---------- */
.badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    display: inline-block;
}

.badge-pendente {
    background: #fef7e6;
    color: #d49b1a;
}

.badge-pago {
    background: #e6f7ed;
    color: #1a8a4a;
}

.badge-atrasado {
    background: #fde8e8;
    color: #e94560;
}

.badge-admin {
    background: linear-gradient(135deg, #ffd700 0%, #f5a623 100%);
    color: #1a1a2e;
}

/* ---------- TIPO BADGES ---------- */
.tipo-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}
.tipo-padrao { background: #eef2ff; color: #1a1a2e; }
.tipo-urgente { background: #fde8e8; color: #e94560; }
.tipo-amigavel { background: #e6f7ed; color: #1a8a4a; }
.tipo-corporativa { background: #f0e6f9; color: #7c3aed; }
.tipo-personalizada { background: #fef7e6; color: #d49b1a; }

/* ---------- ALERTS ---------- */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-success {
    background: #e6f7ed;
    color: #1a8a4a;
    border: 1px solid #b7e4c7;
}

.alert-danger {
    background: #fde8e8;
    color: #e94560;
    border: 1px solid #fcc;
}

.alert-warning {
    background: #fef7e6;
    color: #d49b1a;
    border: 1px solid #fde6b7;
}

.alert-info {
    background: #e6f4f9;
    color: #0f3460;
    border: 1px solid #b7dce8;
}

/* ---------- STATS CARDS ---------- */
.row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
    border-left: 4px solid #e94560;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.10);
}

.stat-card h3 {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 5px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-card .number {
    font-size: 2rem;
    font-weight: 700;
    color: #1a1a2e;
}

/* ---------- FILTERS ---------- */
.filter-section {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

.filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    align-items: end;
}

.filter-section .btn-primary {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border: none;
    color: white;
}

.filter-section .btn-primary:hover {
    background: linear-gradient(135deg, #2a2a4e 0%, #1a1a2e 100%);
}

.filter-section .btn-danger {
    background: linear-gradient(135deg, #e94560 0%, #c0392b 100%);
    border: none;
    color: white;
}

.filter-section .btn-danger:hover {
    background: linear-gradient(135deg, #ff6b81 0%, #e94560 100%);
}

/* ---------- TEMPLATE SELECTOR ---------- */
.template-selector {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.template-selector:hover {
    border-color: #e94560;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.template-selector.active {
    border-color: #e94560;
    background: #fde8e8;
}

.template-selector .template-nome {
    font-weight: 600;
    color: #1a1a2e;
}

.template-selector .template-tipo {
    font-size: 0.8rem;
    color: #888;
}

.template-selector .template-preview {
    font-size: 0.85rem;
    color: #666;
    margin-top: 5px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 5px;
    max-height: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- FOOTER ---------- */
.footer {
    background: #1a1a2e;
    color: rgba(255,255,255,0.7);
    padding: 20px 0;
    text-align: center;
    margin-top: auto;
    border-top: 3px solid #e94560;
}

.footer a {
    color: #ffd700;
    text-decoration: none;
}

.footer a:hover {
    color: #e94560;
}

/* ---------- TOAST ---------- */
.toast {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    animation: slideIn 0.3s ease;
}

.toast-success {
    background: linear-gradient(135deg, #1a8a4a 0%, #28a745 100%);
    color: white;
}

.toast-danger {
    background: linear-gradient(135deg, #e94560 0%, #c0392b 100%);
    color: white;
}

.toast-warning {
    background: linear-gradient(135deg, #ffd700 0%, #f5a623 100%);
    color: #1a1a2e;
}

/* ============================================
   RESPONSIVO - MOBILE FIRST
   ============================================ */

/* Tablets e celulares grandes */
@media (max-width: 992px) {
    .row {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

/* Celulares */
@media (max-width: 768px) {
    /* Menu */
    .menu-toggle {
        display: block;
    }

    .nav-menu {
        display: none;
        width: 100%;
        padding: 15px 0;
    }

    .nav-menu.active {
        display: block;
    }

    .nav-menu ul {
        flex-direction: column;
        gap: 10px;
    }

    .nav-menu a {
        padding: 12px 16px;
        background: rgba(255,255,255,0.05);
        border-radius: 8px;
        margin-bottom: 4px;
    }

    .nav-menu a:hover {
        background: rgba(233, 69, 96, 0.2);
    }

    .nav-menu a.active {
        border-left: 3px solid #e94560;
        background: rgba(233, 69, 96, 0.15);
    }

    /* Cards */
    .card-title {
        flex-direction: column;
        align-items: stretch;
    }
    
    .card-title .btn {
        margin-top: 10px;
        width: 100%;
        justify-content: center;
    }

    /* Botões */
    .btn {
        width: 100%;
        justify-content: center;
        margin-bottom: 5px;
    }

    /* Tabelas */
    table {
        font-size: 0.85rem;
    }

    table th, table td {
        padding: 8px 10px;
    }

    /* Filtros */
    .filter-grid {
        grid-template-columns: 1fr;
    }

    /* Stats */
    .stat-card .number {
        font-size: 1.5rem;
    }

    /* Logo */
    .logo {
        font-size: 1.2rem;
    }

    /* Forms */
    .row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    /* Templates */
    .template-selector {
        margin-bottom: 10px;
    }

    /* Ações em tabelas */
    td .btn {
        width: auto;
        margin-bottom: 0;
    }

    /* Header */
    .header-right span {
        font-size: 0.8rem !important;
    }
    
    .header-right .btn {
        padding: 4px 12px !important;
        font-size: 0.75rem !important;
    }
    
    .header-right .btn span {
        display: none !important;
    }
}

/* Celulares muito pequenos */
@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }

    .card {
        padding: 15px;
    }

    .stat-card {
        padding: 15px;
    }

    .stat-card .number {
        font-size: 1.3rem;
    }

    table th, table td {
        padding: 6px 8px;
        font-size: 0.75rem;
    }

    .badge {
        font-size: 0.7rem;
        padding: 3px 8px;
    }

    .logo span {
        font-size: 1rem !important;
    }
    
    .logo i {
        font-size: 1.2rem !important;
    }
    
    .header-right span {
        font-size: 0.7rem !important;
    }
    
    .header-right .btn {
        padding: 4px 10px !important;
        font-size: 0.7rem !important;
    }
}

/* Impressão */
@media print {
    .header, .footer, .btn, .menu-toggle {
        display: none !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
    
    .stat-card {
        border-left: none !important;
    }
}

/* ---------- ANIMAÇÕES ---------- */
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ---------- UTILITÁRIOS ---------- */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }

.p-10 { padding: 10px; }
.p-20 { padding: 20px; }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-10 { gap: 10px; }
.gap-20 { gap: 20px; }

.w-100 { width: 100%; }
.w-50 { width: 50%; }

/* ---------- CORREÇÃO PARA TELEFONE INVÁLIDO ---------- */
.telefone-invalido {
    border-color: #e94560 !important;
    background-color: #fde8e8;
}

/* ---------- SCROLLBAR PERSONALIZADA ---------- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: #e94560;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #c0392b;
}

/* ---------- CALENDÁRIO ---------- */
.calendar-mini .day.has-bills { 
    background: #fde8e8; 
    border-color: #fcc;
}

.calendar-mini .day.today { 
    background: linear-gradient(135deg, #e94560 0%, #c0392b 100%);
}

.calendar-mini .day.today .day-name { color: rgba(255,255,255,0.7); }
.calendar-mini .day.today .day-number { color: white; }
.calendar-mini .day.today .day-count { color: rgba(255,255,255,0.8); }

/* ---------- RESUMO/RODAPÉ DAS TABELAS ---------- */
.resumo-footer {
    background: linear-gradient(135deg, #f8f9fa 0%, #f0f2f5 100%);
    border-radius: 10px;
    padding: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: space-between;
    align-items: center;
}

.resumo-footer strong {
    color: #1a1a2e;
}

.resumo-footer .valor-total {
    color: #e94560;
    font-weight: 700;
}

/* ---------- BOTÃO "COBRAR TODOS" ---------- */
.btn-cobrar-todos {
    background: linear-gradient(135deg, #ffd700 0%, #f5a623 100%);
    border: none;
    color: #1a1a2e;
    font-weight: 700;
}

.btn-cobrar-todos:hover {
    background: linear-gradient(135deg, #ffe44d 0%, #ffd700 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(255, 215, 0, 0.4);
}

/* ---------- HEADER DAS PÁGINAS DE LISTA ---------- */
.page-header {
    border-bottom: 3px solid #e94560;
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.page-header h1 {
    color: #1a1a2e;
}

.page-header h1 i {
    color: #e94560;
}

/* ---------- PAGINAÇÃO ---------- */
.paginacao .btn-primary {
    background: #1a1a2e;
    border: none;
    color: white;
}

.paginacao .btn-primary:hover {
    background: #2a2a4e;
}

.paginacao .pagina-atual {
    background: linear-gradient(135deg, #e94560 0%, #c0392b 100%);
    color: white;
    padding: 5px 15px;
    border-radius: 8px;
}