/* 
  Dashboard Central - Design System
  Color Palette: Charcoal, Slate and Cool Blues (Premium Dark Mode)
*/

:root {
    --bg-dark: #0f111a;
    --bg-card: #161925;
    --bg-sidebar: #11131c;
    --border-color: #23283b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    
    --success: #10b981;
    --success-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --warning: #f59e0b;
    
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'Courier New', Courier, monospace;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* --- LOGIN PAGE --- */

.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background-image: radial-gradient(circle at top right, rgba(59, 130, 246, 0.08), transparent 40%);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 40px 30px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}

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

.logo-icon {
    font-size: 3rem;
    margin-bottom: 10px;
}

.login-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* --- LAYOUT: DASHBOARD --- */

.dashboard-body {
    height: 100vh;
    overflow: hidden;
}

.dashboard-layout {
    display: flex;
    height: 100vh;
}

/* --- SIDEBAR --- */

.sidebar {
    width: 300px;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 25px 20px;
    border-bottom: 1px solid var(--border-color);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
}

.brand-icon {
    font-size: 1.5rem;
}

.brand h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

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

.user-name {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.btn-logout {
    font-size: 0.8125rem;
    color: var(--danger);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    background-color: rgba(239, 68, 68, 0.08);
    transition: background-color 0.2s;
}

.btn-logout:hover {
    background-color: rgba(239, 68, 68, 0.16);
}

.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px 0;
    overflow: hidden;
}

.sidebar-nav h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0 20px 10px 20px;
}

.postos-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 10px;
}

.posto-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 15px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 6px;
    transition: background-color 0.2s, border-color 0.2s;
    border: 1px solid transparent;
}

.posto-item:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.posto-item.active {
    background-color: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.3);
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.online .status-indicator {
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.offline .status-indicator {
    background-color: var(--text-muted);
}

.posto-details {
    display: flex;
    flex-direction: column;
}

.posto-name {
    font-size: 0.9375rem;
    font-weight: 500;
}

.posto-id {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.sidebar-actions {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* --- MAIN CONTENT --- */

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 25px;
    gap: 25px;
    overflow-y: auto;
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.work-area-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 400px;
}

.empty-workspace {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1;
    text-align: center;
    padding: 40px;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 15px;
    opacity: 0.6;
}

.empty-workspace h2 {
    font-size: 1.25rem;
    margin-bottom: 8px;
}

.empty-workspace p {
    color: var(--text-muted);
    font-size: 0.9375rem;
    max-width: 360px;
}

.workspace {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 25px;
}

.workspace-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
    margin-bottom: 20px;
}

.workspace-header h2 {
    font-size: 1.375rem;
    font-weight: 700;
}

.status-pill {
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-pill.online {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-pill.offline {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

.workspace-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
}

.busca-section {
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.busca-section h3, .resultados-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 15px;
    color: var(--text-muted);
}

.form-row {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.form-row .form-group {
    flex: 1;
    min-width: 180px;
}

.form-row .align-end {
    flex: 0 0 auto;
}

/* --- FORMS & INPUTS --- */

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 15px;
}

.form-group label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-muted);
}

input[type="text"],
input[type="password"] {
    background-color: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 14px;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

small {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* --- BUTTONS --- */

.btn {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    font-weight: 500;
    font-size: 0.875rem;
    padding: 10px 20px;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    outline: none;
}

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-primary:disabled {
    background-color: rgba(59, 130, 246, 0.5);
    cursor: not-allowed;
}

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border-color: var(--border-color);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
}

.btn-danger:hover {
    background-color: var(--danger-hover);
}

.btn-danger:disabled {
    background-color: rgba(239, 68, 68, 0.4);
    cursor: not-allowed;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.75rem;
    border-radius: 4px;
}

/* --- TABLES --- */

.table-container {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 15px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table th, .table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.table th {
    background-color: rgba(255, 255, 255, 0.02);
    font-weight: 600;
    color: var(--text-muted);
}

.table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.01);
}

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

/* --- AUDIT CARD --- */

.audit-card {
    padding: 20px;
}

.audit-card .card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.audit-card .table-container {
    max-height: 200px;
}

.font-mono {
    font-family: var(--font-mono);
}

.text-sm {
    font-size: 0.8125rem;
}

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

.whitespace-nowrap {
    white-space: nowrap;
}

/* --- BADGES --- */

.badge {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.badge-op {
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.op-busca {
    background-color: rgba(59, 130, 246, 0.1);
    color: var(--primary);
}

.op-login {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.op-correcao, .op-correcao_fim {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

/* --- ALERTS --- */

.alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    border-radius: 6px;
    font-size: 0.875rem;
    margin-bottom: 20px;
}

.alert-error {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #fca5a5;
}

/* --- ACTION FOOTER --- */

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

.selected-count {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* --- MODALS --- */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    padding: 30px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    position: relative;
    animation: modalFadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.close-btn {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.close-btn:hover {
    color: var(--text-main);
}

.modal h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
