/* ============================================
   DASHBOARD — MODA NA VEIA
   Theme: Dark with Copper accents
   All variables defined inline (no external deps)
   ============================================ */

:root {
    --bg-primary: #070605;
    --bg-card: rgba(255,255,255,0.03);
    --bg-input: rgba(255,255,255,0.05);
    --text-light: #e8e6e3;
    --text-muted: #9ca3af;
    --brand-copper: #b87333;
    --brand-copper-hover: #d4884a;
    --border-color: rgba(255,255,255,0.08);
    --color-error: #ef4444;
    --color-success: #22c55e;
    --font-body: 'Inter', system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font-body);
    background: var(--bg-primary);
    color: var(--text-light);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   LOGIN OVERLAY
   ============================================ */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(20px);
    transition: opacity 0.3s, visibility 0.3s;
}

.login-overlay.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.login-card {
    width: 100%;
    max-width: 440px;
    padding: 2.5rem;
    text-align: center;
}

.login-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.login-logo {
    height: 36px;
    width: auto;
    object-fit: contain;
    border-radius: 8px;
}

.login-logo-separator {
    font-size: 1.2rem;
    color: var(--text-muted);
    font-weight: 300;
    opacity: 0.5;
}

.login-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--brand-copper);
    margin-bottom: 0.25rem;
}

.login-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 2.5rem;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
}

.login-form .form-input {
    text-align: center;
    font-size: 1.1rem;
    letter-spacing: 0.05em;
}

.login-status {
    margin-top: 0.5rem;
    min-height: 1.5rem;
    font-size: 0.875rem;
}

.login-status.status-error { color: var(--color-error); }
.login-status.status-success { color: var(--color-success); }

.login-footer {
    margin-top: 2rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.6;
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */
.dashboard {
    min-height: 100vh;
    padding: 1.5rem;
    max-width: 1440px;
    margin: 0 auto;
}

/* HEADER */
.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.dash-header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dash-logos {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dash-logo-img {
    height: 32px;
    width: auto;
    object-fit: contain;
    border-radius: 6px;
}

.dash-logo-separator {
    font-size: 0.9rem;
    font-weight: 300;
    color: var(--text-muted);
    opacity: 0.5;
}

.dash-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--brand-copper);
    line-height: 1.2;
}

.dash-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.125rem;
}

.dash-header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dash-status {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-success);
    animation: pulse-dot 2s infinite;
}

.status-dot.is-offline {
    background: var(--color-error);
    animation: none;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* KPI GRID */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: border-color 0.2s;
}

.kpi-card:hover {
    border-color: var(--brand-copper);
}

.kpi-icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}

.kpi-content {
    display: flex;
    flex-direction: column;
}

.kpi-value {
    font-size: 2rem;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text-light);
}

.kpi-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* CHARTS */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

.chart-card--wide {
    grid-column: 1 / -1;
}

.chart-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-light);
    margin-bottom: 1rem;
}

.chart-container {
    position: relative;
    height: 250px;
}

.chart-container--small {
    max-width: 280px;
    margin: 0 auto;
    height: 280px;
}

/* TABLE SECTION */
.table-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.table-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

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

.search-wrapper svg {
    position: absolute;
    left: 0.75rem;
    color: var(--text-muted);
    pointer-events: none;
}

.search-input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    color: var(--text-light);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
    min-width: 250px;
    font-family: var(--font-body);
}

.search-input:focus {
    border-color: var(--brand-copper);
}

.search-input::placeholder {
    color: var(--text-muted);
}

/* DATA TABLE */
.table-wrapper {
    overflow-x: auto;
    margin-bottom: 1rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    font-family: var(--font-body);
}

.data-table th,
.data-table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table th {
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    user-select: none;
    cursor: pointer;
    transition: color 0.2s;
}

.data-table th:hover {
    color: var(--brand-copper);
}

.data-table th.sort-asc::after { content: ' ▲'; }
.data-table th.sort-desc::after { content: ' ▼'; }

.data-table tbody tr {
    transition: background 0.15s;
}

.data-table tbody tr:hover {
    background: rgba(184, 115, 51, 0.05);
}

.data-table td {
    color: var(--text-light);
}

.table-empty {
    text-align: center !important;
    padding: 2rem !important;
    color: var(--text-muted);
}

.type-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
}

.type-badge.individual {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.type-badge.grupo {
    background: rgba(96, 165, 250, 0.15);
    color: #60a5fa;
}

/* PAGINATION */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding-top: 0.5rem;
}

.page-info {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* BUTTONS */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: none;
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
    font-family: var(--font-body);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--brand-copper);
    color: var(--text-light);
}

.btn-primary:hover:not(:disabled) {
    background: var(--brand-copper-hover);
}

.btn-secondary {
    background: rgba(255,255,255,0.08);
    color: var(--text-light);
    border: 1px solid rgba(255,255,255,0.12);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255,255,255,0.12);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 0.5rem;
}

.btn-ghost:hover:not(:disabled) {
    color: var(--text-light);
    background: rgba(255,255,255,0.05);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* FORM INPUT */
.form-input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-light);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s;
    width: 100%;
    font-family: var(--font-body);
}

.form-input:focus {
    border-color: var(--brand-copper);
}

.form-label {
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.3rem;
    text-align: left;
    color: var(--text-light);
}

/* LOADING */
.loading-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: var(--brand-copper);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* TOAST NOTIFICATIONS */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    max-width: 360px;
    animation: slideIn 0.3s ease;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    font-family: var(--font-body);
}

.toast.error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.toast.success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.toast.info {
    background: rgba(96, 165, 250, 0.15);
    border: 1px solid rgba(96, 165, 250, 0.3);
    color: #60a5fa;
}

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

/* RESPONSIVE */
@media (max-width: 768px) {
    .dashboard { padding: 1rem; }
    .dash-header { flex-direction: column; align-items: flex-start; }
    .dash-header-right { width: 100%; justify-content: flex-end; }
    .dash-logos { flex-wrap: wrap; }
    .dash-logo-img { height: 28px; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .charts-grid { grid-template-columns: 1fr; }
    .table-header { flex-direction: column; align-items: flex-start; }
    .table-actions { width: 100%; }
    .search-input { min-width: 100%; }
    .data-table { font-size: 0.8rem; }
    .data-table th, .data-table td { padding: 0.5rem 0.6rem; }
}

@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr 1fr; gap: 0.75rem; }
    .kpi-card { padding: 1rem; }
    .kpi-value { font-size: 1.5rem; }
    .kpi-icon { font-size: 1.5rem; }
    .login-card { padding: 1.5rem; }
    .login-title { font-size: 1.5rem; }
    .login-logos { gap: 0.5rem; }
    .login-logo { height: 28px; }
    .dash-logo-img { height: 24px; }
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
