/* ============================
   VINUTTO CRM - ESTILOS
   ============================ */

/* ===== RESET E VARIÁVEIS ===== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary: #64748b;
    --success: #10b981;
    --success-dark: #059669;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --warning: #f59e0b;
    --warning-dark: #d97706;
    --admin: #854d0e;
    --dark: #0f172a;
    --dark-secondary: #1e293b;
    --light: #f8fafc;
    --gray: #f1f5f9;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    
    --shadow-sm: 0 2px 5px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 15px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
    --shadow-xl: 0 25px 50px rgba(0,0,0,0.25);
    
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Roboto', sans-serif;
    background: var(--gray);
    color: var(--text);
    line-height: 1.6;
}

/* ===== BOTÕES ===== */
button, .btn-link {
    cursor: pointer;
    border: none;
    border-radius: var(--radius-md);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 13px;
    padding: 10px 18px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

button:hover, .btn-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

button:active, .btn-link:active {
    transform: translateY(0);
}

.btn-icon {
    font-size: 14px;
}

/* Botão Primário */
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

/* Botão Secundário */
.btn-secondary {
    background: var(--dark-secondary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
    background: var(--dark);
    box-shadow: 0 4px 15px rgba(30, 41, 59, 0.3);
}

/* Botão de Sucesso */
.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-success:hover {
    background: linear-gradient(135deg, var(--success-dark) 0%, var(--success) 100%);
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

/* Botão de Perigo */
.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, var(--danger-dark) 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover {
    background: linear-gradient(135deg, var(--danger-dark) 0%, var(--danger) 100%);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

/* Botão Admin */
.btn-admin {
    background: linear-gradient(135deg, var(--warning) 0%, var(--warning-dark) 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-admin:hover {
    background: linear-gradient(135deg, var(--warning-dark) 0%, var(--warning) 100%);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
}

/* Botão Exportar */
.btn-export {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    box-shadow: var(--shadow-sm);
}

.btn-export:hover {
    background: linear-gradient(135deg, #1d4ed8 0%, #3b82f6 100%);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

/* Botão Books/Tabelas */
.btn-books {
    background: linear-gradient(135deg, var(--warning) 0%, var(--warning-dark) 100%);
    color: white;
    padding: 10px 24px;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(202, 138, 4, 0.3);
    border-radius: var(--radius-lg);
}

.btn-books:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(202, 138, 4, 0.4);
}

/* ===== INPUTS E FORMULÁRIOS ===== */
input, select, textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    transition: var(--transition);
    background: white;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.iti {
    width: 100% !important;
    display: block !important;
    margin-bottom: 2px;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field-group label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* ===== TELA DE LOGIN ===== */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--dark) 0%, var(--dark-secondary) 100%);
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-xl);
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo h1 {
    font-size: 28px;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 5px;
}

.login-logo-img {
    height: 50px;
    width: auto;
    max-width: 250px;
    object-fit: contain;
    margin-bottom: 10px;
}

.login-logo p {
    color: var(--text-muted);
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.login-form input {
    padding: 14px;
    font-size: 15px;
}

.login-form button {
    padding: 14px;
    font-size: 15px;
    font-weight: 700;
    margin-top: 10px;
}

/* ===== HEADER ===== */
header {
    background: var(--dark);
    color: white;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    box-shadow: var(--shadow-md);
}

.logo {
    font-weight: 800;
    font-size: 22px;
    letter-spacing: -0.5px;
}

.logo-img {
    height: 40px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.header-actions {
    display: flex;
    gap: 10px;
}

.user-info {
    font-size: 13px;
    font-weight: 600;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
}

/* ===== CONTAINER ===== */
.container {
    padding: 25px;
    max-width: 1600px;
    margin: 0 auto;
}

/* ===== PAINEL ADMIN ===== */
.admin-panel {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fef08a;
    padding: 20px;
    border-radius: var(--radius-lg);
    margin-bottom: 25px;
    box-shadow: var(--shadow-sm);
}

.admin-header h4 {
    font-size: 13px;
    color: var(--admin);
    margin-bottom: 15px;
    font-weight: 700;
}

.admin-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-actions button {
    background: white;
    border: 1px solid #fef08a;
    color: var(--admin);
    padding: 8px 14px;
    font-size: 11px;
    font-weight: 600;
}

.admin-actions button:hover {
    background: var(--admin);
    color: white;
    border-color: var(--admin);
}

/* ===== BARRA DE AÇÕES ===== */
.actions-bar {
    margin-bottom: 25px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ===== FORMULÁRIO ===== */
.form-inline {
    background: white;
    padding: 25px;
    border-radius: var(--radius-lg);
    margin-bottom: 25px;
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
    box-shadow: var(--shadow-sm);
    align-items: flex-end;
}

/* ===== FILTROS ===== */
.filters-area {
    background: white;
    padding: 20px;
    border-radius: var(--radius-lg);
    margin-bottom: 25px;
    display: flex;
    gap: 20px;
    align-items: flex-end;
    box-shadow: var(--shadow-sm);
}

.filter-group {
    flex: 1;
}

.filter-group label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    display: block;
    margin-bottom: 6px;
}

.search-input {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
}

#searchFilter {
    padding-left: 38px;
}

#corretorFilter {
    padding: 10px;
}

/* ===== TABELA ===== */
.table-box {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1300px;
}

th {
    background: var(--light);
    padding: 15px;
    text-align: left;
    font-size: 11px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.3px;
}

td {
    padding: 15px;
    font-size: 13px;
    border-bottom: 1px solid var(--gray);
    vertical-align: middle;
}

tr:hover {
    background: rgba(248, 250, 252, 0.5);
}

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

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

/* Status */
.status {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    letter-spacing: 0.3px;
}

.status.atendimento {
    background: #e0f2fe;
    color: #075985;
}

.status.visita {
    background: #fef3c7;
    color: #92400e;
}

.status.venda {
    background: #fae8ff;
    color: #86198f;
}

.status.perdido {
    background: #fee2e2;
    color: #991b1b;
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-box {
    background: white;
    width: 95%;
    max-width: 750px;
    border-radius: var(--radius-xl);
    padding: 30px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
}

.modal-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--gray);
}

.modal-header h2 {
    font-size: 22px;
    color: var(--dark);
}

.modal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-top: 15px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 25px;
}

.modal-actions button {
    flex: 1;
    padding: 14px;
    font-size: 14px;
    font-weight: 700;
}

/* Timeline */
.timeline {
    margin-top: 25px;
    border-top: 1px solid var(--gray);
    padding-top: 20px;
}

.timeline h3 {
    font-size: 14px;
    color: var(--dark);
    margin-bottom: 15px;
}

#m-timeline {
    max-height: 200px;
    overflow-y: auto;
}

#m-timeline strong {
    display: block;
    margin-bottom: 10px;
    color: var(--dark);
}

#m-timeline div {
    border-left: 3px solid var(--primary);
    padding: 8px 12px;
    margin-top: 8px;
    font-size: 12px;
    background: var(--light);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

#m-timeline div b {
    color: var(--primary);
}

/* ===== RESPONSIVO ===== */
@media (max-width: 991px) {
    .header-center {
        position: static;
        transform: none;
        order: 3;
        width: 100%;
        margin-top: 15px;
    }
    
    header {
        flex-wrap: wrap;
        padding: 20px;
    }
    
    .header-right {
        order: 2;
    }
    
    .modal-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-actions {
        flex-direction: column;
    }
}

@media (max-width: 767px) {
    header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .header-actions {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .filters-area {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        width: 100%;
    }
    
    .container {
        padding: 15px;
    }
    
    .login-box {
        padding: 30px 25px;
    }
    
    .modal-box {
        padding: 20px;
    }
    
    .form-inline {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .actions-bar {
        flex-direction: column;
    }
    
    .actions-bar button {
        width: 100%;
    }
    
    table {
        min-width: 800px;
    }
    
    .admin-actions {
        flex-direction: column;
    }
    
    .admin-actions button {
        width: 100%;
    }
}