/* ==========================================================================
   OrçaPro - Folha de Estilos Principal
   ========================================================================== */

/* --- Configurações Globais e Variáveis --- */
:root {
    --primary-color: #bef264; /* Verde Limão Vibrante */
    --primary-hover: #a3e635;
    --body-bg: #18181b; /* Fundo escuro (quase preto) */
    --card-bg: #27272a; /* Cor dos cards e inputs */
    --sidebar-bg: #27272a;
    --text-primary: #f4f4f5; /* Texto principal (branco suave) */
    --text-secondary: #a1a1aa; /* Texto secundário (cinza claro) */
    --border-color: #3f3f46;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

body {
    background-color: var(--body-bg);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--body-bg); }
::-webkit-scrollbar-thumb { background-color: var(--border-color); border-radius: 20px; }

/* ==========================================================================
   Tela de Autenticação
   ========================================================================== */
#authView {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
    padding: 20px;
}

.auth-box {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 420px;
    text-align: center;
    animation: fadeInUp 0.5s ease-out;
}

.auth-box h1 { color: var(--primary-color); margin-bottom: 10px; }
.auth-box p { margin-bottom: 30px; color: var(--text-secondary); }
.auth-box .input-group { position: relative; margin-bottom: 20px; }
.auth-box .input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    transition: color 0.3s ease;
}
.auth-box .input-group input:focus + i { color: var(--primary-color); }
.auth-toggle { margin-top: 20px; font-size: 0.9rem; }
.auth-toggle a { color: var(--primary-color); text-decoration: none; font-weight: 600; }

/* ==========================================================================
   Layout Principal da Aplicação
   ========================================================================== */
.app-layout { display: flex; flex-direction: column; height: 100vh; }
.main-container { display: flex; flex-grow: 1; overflow: hidden; }

.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    padding: 20px;
    transition: width 0.3s ease;
    flex-shrink: 0;
}

.sidebar-header { text-align: center; margin-bottom: 40px; }
.sidebar-header h2 { font-size: 1.8rem; color: var(--primary-color); font-weight: 700; }
.sidebar-nav { flex-grow: 1; }

.sidebar-nav a, .sidebar-footer a {
    display: flex; align-items: center; padding: 15px; color: var(--text-secondary);
    text-decoration: none; border-radius: 8px; margin-bottom: 10px; font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}
.sidebar-nav a:hover, .sidebar-footer a:hover { background-color: var(--border-color); color: var(--text-primary); }
.sidebar-nav a.active { background-color: var(--primary-color); color: var(--body-bg); font-weight: 600; }
.sidebar-footer a:hover { background-color: var(--danger-hover); color: var(--text-primary); }
.sidebar-nav a i, .sidebar-footer a i { margin-right: 15px; width: 20px; text-align: center; font-size: 1.1rem; }

.main-content { flex-grow: 1; overflow-y: auto; padding: 40px; }
.page { display: none; max-width: 1200px; margin: 0 auto; }
.page.active { display: block; }
.page > * { animation: fadeInUp 0.4s ease-out both; }
.page > *:nth-child(2) { animation-delay: 0.1s; }
.page > *:nth-child(3) { animation-delay: 0.2s; }

.page-header { margin-bottom: 30px; }
.page-header h1 { font-size: 2.2rem; }
.page-header p { color: var(--text-secondary); }

/* ==========================================================================
   Componentes Gerais
   ========================================================================== */
input, textarea {
    width: 100%; padding: 14px 14px 14px 45px; background: #18181b;
    border: 1px solid var(--border-color); border-radius: 8px; font-size: 1rem;
    color: var(--text-primary); transition: border-color 0.3s ease, box-shadow 0.3s ease;
}
input:focus, textarea:focus {
    outline: none; border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(190, 242, 100, 0.2);
}
.btn {
    display: inline-block; width: 100%; padding: 14px; border: none;
    border-radius: 8px; background-color: var(--primary-color); color: #18181b;
    font-size: 1.1rem; font-weight: 700; cursor: pointer;
    transition: all 0.3s ease; text-align: center; text-decoration: none;
}
.btn:hover {
    background-color: var(--primary-hover); transform: translateY(-3px);
    box-shadow: 0 4px 15px rgba(190, 242, 100, 0.2);
}
.btn-outline {
    background: transparent; border: 1px solid var(--primary-color); color: var(--primary-color);
    padding: 8px 15px; border-radius: 8px; cursor: pointer; transition: all 0.3s; width: auto;
}
.btn-outline:hover { background: var(--primary-color); color: #18181b; }
.card {
    background: var(--card-bg); border-radius: 12px; padding: 30px;
    border: 1px solid var(--border-color); box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}
.card-title { font-size: 1.2rem; margin-bottom: 20px; font-weight: 600; }
.grid-container { display: grid; gap: 25px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.table-container { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; }
.data-table th, .data-table td { padding: 15px 20px; border-bottom: 1px solid var(--border-color); white-space: nowrap; }
.data-table thead th { background-color: #3f3f46; color: var(--text-primary); }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background-color 0.2s; }
.data-table tbody tr:hover { background-color: #3f3f46; }
.data-table .status { padding: 5px 10px; border-radius: 20px; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; }
.status.Pendente { background-color: rgba(250, 204, 21, 0.2); color: #facc15; }
.status.Aceita { background-color: rgba(74, 222, 128, 0.2); color: #4ade80; }
.status.Recusada { background-color: rgba(248, 113, 113, 0.2); color: #f87171; }
.no-data-message { text-align: center; padding: 40px; color: var(--text-secondary); }
.action-icons { display: flex; gap: 15px; align-items: center; }
.action-icon { color: var(--text-secondary); font-size: 1.2rem; text-decoration: none; transition: color 0.3s, transform 0.3s; }
.action-icon:hover { transform: scale(1.2); }
.action-icon.view { color: #60a5fa; }
.action-icon.print { color: #f472b6; }
.action-icon.whatsapp { color: #4ade80; }
.action-icon.edit-client-btn { color: #f59e0b; }
.form-vertical .input-group { text-align: left; margin-bottom: 25px; }
.form-vertical .input-group label { display: block; margin-bottom: 8px; font-weight: 500; color: var(--text-secondary); }
.form-vertical .input-group input, .form-vertical .input-group textarea { padding: 12px 15px; }
.form-vertical textarea { resize: vertical; min-height: 80px; }
.form-vertical hr.form-divider { border: none; border-top: 1px solid var(--border-color); margin: 30px 0; }

/* ==========================================================================
   Estilos Específicos das Páginas
   ========================================================================== */
.chart-container { position: relative; height: 45vh; min-height: 350px; }
.stat-cards { margin-bottom: 30px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stat-card { display: flex; align-items: center; gap: 20px; padding: 20px; }
.stat-card-icon { width: 50px; height: 50px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0; }
.stat-card-info { display: flex; flex-direction: column; }
.stat-card-title { color: var(--text-secondary); font-size: 0.9rem; margin-bottom: 4px; }
.stat-card-value { font-size: 1.5rem; font-weight: 600; color: var(--text-primary); }
.dashboard-main-grid { grid-template-columns: 2fr 1fr; align-items: flex-start; }
.recent-quotes-list { list-style: none; max-height: 45vh; overflow-y: auto; padding-right: 10px; }
.recent-quotes-list li { display: flex; justify-content: space-between; align-items: center; padding: 15px 5px; border-bottom: 1px solid var(--border-color); transition: background-color 0.3s; }
.recent-quotes-list li:last-child { border-bottom: none; }
.recent-quotes-list li:hover { background-color: #3f3f46; border-radius: 8px; }
.recent-quotes-list .quote-info span { display: block; }
.recent-quotes-list .quote-client { font-weight: 500; color: var(--text-primary); font-size: 0.95rem; }
.recent-quotes-list .quote-value { font-size: 0.85rem; color: var(--text-secondary); }
.recent-quotes-list .quote-link { color: var(--primary-color); text-decoration: none; font-size: 1.2rem; transition: transform 0.3s; }
.recent-quotes-list .quote-link:hover { transform: translateX(5px); }
.profile-logo-section { text-align: center; }
.logo-uploader { display: flex; flex-direction: column; align-items: center; gap: 15px; }
.logo-uploader img { width: 150px; height: 150px; border-radius: 50%; object-fit: cover; border: 3px solid var(--border-color); }
.account-status-banner { padding: 15px 20px; border-radius: 8px; margin-bottom: 30px; text-align: center; font-weight: 500; }
.account-status-banner.trial { background-color: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.account-status-banner.inactive { background-color: rgba(239, 68, 68, 0.2); color: #ef4444; }

/* ==========================================================================
   Modal de Edição
   ========================================================================== */
.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: rgba(0, 0, 0, 0.7); display: flex;
    align-items: center; justify-content: center; z-index: 2000;
    backdrop-filter: blur(5px); padding: 20px;
}
.modal-content {
    background: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: 12px; width: 100%; max-width: 700px;
    max-height: 90vh; display: flex; flex-direction: column;
    animation: fadeInUp 0.3s ease-out;
}
.modal-header { padding: 20px 30px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.modal-header h2 { color: var(--primary-color); font-size: 1.4rem; }
.modal-close-btn { background: none; border: none; color: var(--text-secondary); font-size: 2rem; cursor: pointer; line-height: 1; transition: color 0.3s; }
.modal-close-btn:hover { color: var(--text-primary); }
.modal-body { padding: 30px; overflow-y: auto; }
.modal-footer { padding: 20px 30px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 15px; flex-shrink: 0; }
.modal-footer .btn, .modal-footer .btn-outline { width: auto; min-width: 120px; }

/* ==========================================================================
   Responsividade (Tablet & Mobile)
   ========================================================================== */
@media (max-width: 992px) {
    .dashboard-main-grid { grid-template-columns: 1fr; }
    .recent-quotes-list, .chart-container { max-height: none; height: 350px; }
}
@media (max-width: 768px) {
    body { padding-bottom: 70px; }
    .main-container { flex-direction: column; }
    .sidebar {
        position: fixed; bottom: 0; left: 0; right: 0; width: 100%; height: 70px;
        flex-direction: row; padding: 0 10px; border-top: 1px solid var(--border-color);
        border-right: none; z-index: 1000;
    }
    .sidebar-header { display: none; }
    .sidebar-nav { flex-grow: 1; display: flex; justify-content: space-around; }
    .sidebar-footer { height: 100%; }
    .sidebar-nav a, .sidebar-footer a {
        flex: 1; flex-direction: column; justify-content: center; align-items: center;
        margin: 0; height: 100%; padding: 10px 5px;
    }
    .sidebar-nav span, .sidebar-footer span { display: none; }
    .sidebar-nav a i, .sidebar-footer a i { margin: 0 0 5px 0; font-size: 1.4rem; }
    .main-content { padding: 15px; }
    .page-header h1 { font-size: 1.8rem; }
    .card { padding: 20px; }
    .dashboard-main-grid .card, .stat-card { padding: 15px; }
    .chart-container { height: 300px; min-height: auto; }
    .recent-quotes-list { height: auto; max-height: 400px; }
    .stat-card-value { font-size: 1.3rem; }
    .items-entry-table thead { display: none; }
    .items-entry-table tr { display: block; border: 1px solid var(--border-color); border-radius: 8px; padding: 15px; margin-bottom: 15px; }
    .items-entry-table td { display: block; text-align: left; padding: 0; padding-bottom: 15px; }
    .items-entry-table td:last-child { padding-bottom: 0; text-align: right; }
    .items-entry-table td:last-child::before { display: none; }
    .items-entry-table td::before { content: attr(data-label); display: block; font-weight: 500; color: var(--text-secondary); margin-bottom: 5px; font-size: 0.9rem; }
    .items-entry-table input[type="text"], .items-entry-table input[type="number"] { width: 100%; padding: 12px 15px; }
}