/* ============================================
   FONTOURA CAR - Agência de Veículos
   Premium Dark Theme (mesmo padrão locação)
   ============================================ */

/* === CSS Variables === */
:root {
    --bg-primary: #050505;
    --bg-secondary: #111111;
    --bg-card: #141414;
    --bg-card-hover: #1f1f1f;
    --bg-input: #1a1a1a;
    --bg-sidebar: #000000;

    --text-primary: #f5f5f5;
    --text-secondary: #a3a3a3;
    --text-muted: #525252;

    --accent-primary: #ef4444;
    --accent-primary-hover: #dc2626;
    --accent-primary-glow: rgba(239, 68, 68, 0.3);

    --accent-success: #10b981;
    --accent-success-bg: rgba(16, 185, 129, 0.12);
    --accent-danger: #ef4444;
    --accent-danger-bg: rgba(239, 68, 68, 0.12);
    --accent-warning: #f59e0b;
    --accent-warning-bg: rgba(245, 158, 11, 0.12);
    --accent-info: #3b82f6;
    --accent-info-bg: rgba(59, 130, 246, 0.12);
    --accent-purple: #8b5cf6;
    --accent-purple-bg: rgba(139, 92, 246, 0.12);

    --border-color: rgba(255, 255, 255, 0.1);
    --border-light: rgba(255, 255, 255, 0.15);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.7);
    --shadow-glow: 0 0 20px rgba(239, 68, 68, 0.15);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --sidebar-width: 260px;
    --topbar-height: 64px;

    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === LIGHT THEME === */
[data-theme="light"] {
    --bg-primary: #f5f5f5;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f0f0;
    --bg-input: #f8f8f8;
    --bg-sidebar: #ffffff;

    --text-primary: #1a1a1a;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    --accent-primary: #dc2626;
    --accent-primary-hover: #b91c1c;
    --accent-primary-glow: rgba(220, 38, 38, 0.2);

    --accent-success: #059669;
    --accent-success-bg: rgba(5, 150, 105, 0.1);
    --accent-danger: #dc2626;
    --accent-danger-bg: rgba(220, 38, 38, 0.08);
    --accent-warning: #d97706;
    --accent-warning-bg: rgba(217, 119, 6, 0.08);
    --accent-info: #2563eb;
    --accent-info-bg: rgba(37, 99, 235, 0.08);
    --accent-purple: #7c3aed;
    --accent-purple-bg: rgba(124, 58, 237, 0.08);

    --border-color: rgba(0, 0, 0, 0.1);
    --border-light: rgba(0, 0, 0, 0.15);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 20px rgba(220, 38, 38, 0.1);
}

[data-theme="light"] .topbar {
    background: rgba(255, 255, 255, 0.9);
}

[data-theme="light"] .data-table td {
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .nav-item:hover {
    background: rgba(220, 38, 38, 0.06);
}

[data-theme="light"] .nav-item.active {
    background: rgba(220, 38, 38, 0.1);
}

[data-theme="light"] .tab:hover {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .btn-secondary {
    background: #f0f0f0;
}

[data-theme="light"] .btn-secondary:hover {
    background: #e5e5e5;
}

[data-theme="light"] .stat-icon {
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .sidebar-overlay {
    background: rgba(0, 0, 0, 0.3);
}

/* === Theme Toggle Button === */
.theme-toggle {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 18px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
}

.theme-toggle:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-primary);
    transform: scale(1.05);
}

/* === Reset & Base === */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.6;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* === Sidebar === */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: var(--transition);
    overflow-y: auto;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    overflow: hidden;
    height: 105px;
    border-radius: 8px;
}

.logo-img {
    width: 100%;
    height: auto;
    object-fit: cover;
    transform: scale(1.25);
}

.logo-icon {
    font-size: 28px;
}

.logo-text {
    font-size: 20px;
    font-weight: 800;
    background: linear-gradient(135deg, var(--accent-primary), #ff7b7b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.sidebar-close:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.nav-menu {
    list-style: none;
    padding: 12px 10px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 4px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13px;
    position: relative;
    overflow: hidden;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-primary);
    border-radius: 0 3px 3px 0;
    transform: scaleY(0);
    transition: var(--transition);
}

.nav-item:hover {
    background: rgba(239, 68, 68, 0.08);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(239, 68, 68, 0.12);
    color: var(--accent-primary);
}

.nav-item.active::before {
    transform: scaleY(1);
}

.nav-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

.footer-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.version {
    font-size: 11px;
    color: var(--text-muted);
}

.offline-badge {
    font-size: 11px;
    color: var(--accent-success);
    background: var(--accent-success-bg);
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
}

/* === Sidebar Overlay === */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 99;
}

/* === Main Content === */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    transition: var(--transition);
}

/* === Top Bar === */
.topbar {
    height: var(--topbar-height);
    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    gap: 16px;
}

.menu-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.menu-toggle:hover {
    background: var(--bg-card);
}

.page-title {
    font-size: 18px;
    font-weight: 700;
    flex: 1;
}

.current-date {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

/* === Page Container === */
.page-container {
    padding: 24px;
    max-width: 1400px;
}

.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === Stats Grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stats-3 {
    grid-template-columns: repeat(3, 1fr);
}

.stats-5 {
    grid-template-columns: repeat(5, 1fr);
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.stat-primary::before {
    background: linear-gradient(90deg, var(--accent-primary), #a855f7);
}

.stat-success::before {
    background: linear-gradient(90deg, var(--accent-success), #34d399);
}

.stat-info::before {
    background: linear-gradient(90deg, var(--accent-info), #60a5fa);
}

.stat-warning::before {
    background: linear-gradient(90deg, var(--accent-warning), #fbbf24);
}

.stat-danger::before {
    background: linear-gradient(90deg, var(--accent-danger), #f87171);
}

.stat-purple::before {
    background: linear-gradient(90deg, var(--accent-purple), #a78bfa);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-icon {
    font-size: 32px;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
}

.stat-info-text {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 24px;
    font-weight: 800;
    line-height: 1.2;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* === Cards === */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 20px;
    transition: var(--transition);
}

.card:hover {
    border-color: var(--border-light);
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* === Dashboard === */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.finance-summary {
    display: flex;
    gap: 20px;
}

.finance-item {
    flex: 1;
    padding: 16px;
    border-radius: var(--radius-md);
    text-align: center;
}

.finance-item.income {
    background: var(--accent-success-bg);
}

.finance-item.expense {
    background: var(--accent-danger-bg);
}

.finance-item.profit {
    background: var(--accent-info-bg);
}

.finance-label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.finance-value {
    font-size: 20px;
    font-weight: 700;
}

/* === Connection Status === */
.connection-status {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
    transition: var(--transition);
}
.connection-status.online {
    color: var(--accent-success);
    background: var(--accent-success-bg);
}
.connection-status.online.pending {
    color: var(--accent-warning);
    background: var(--accent-warning-bg);
    animation: pulseSync 2s infinite;
}
.connection-status.offline {
    color: var(--accent-danger);
    background: var(--accent-danger-bg);
}

@keyframes pulseSync {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* === Recent Sales === */
.recent-sales {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.sale-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-success);
    transition: var(--transition);
}

.sale-item:hover {
    background: var(--bg-card-hover);
}

.sale-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sale-name {
    font-weight: 600;
    font-size: 13px;
}

.sale-detail {
    font-size: 11px;
    color: var(--text-secondary);
}

.sale-value {
    font-weight: 700;
    color: var(--accent-success);
    font-size: 14px;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), #b91c1c);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--accent-success), #059669);
    color: white;
}

.btn-success:hover {
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--accent-danger), #dc2626);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-1px);
}

.btn-warning {
    background: linear-gradient(135deg, var(--accent-warning), #d97706);
    color: white;
}

.btn-info {
    background: linear-gradient(135deg, var(--accent-info), #2563eb);
    color: white;
}

.btn-info:hover {
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 15px;
}

.btn-icon {
    padding: 8px;
    min-width: 36px;
}

/* === Page Actions === */
.page-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

/* === Tabs === */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: var(--bg-card);
    padding: 4px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow-x: auto;
}

.tab {
    padding: 10px 20px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
}

.tab:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.tab.active {
    background: var(--accent-primary);
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* === Forms === */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.full-width {
    grid-column: span 2;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-text,
.input-select,
.input-textarea,
.input-search,
.input-field {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    transition: var(--transition);
    outline: none;
    width: 100%;
}

.input-text:focus,
.input-select:focus,
.input-textarea:focus,
.input-search:focus,
.input-field:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.input-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10L6 8z' fill='%238892a8'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.input-search {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238892a8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 12px center;
    padding-left: 38px;
    max-width: 300px;
}

.input-textarea {
    resize: vertical;
    min-height: 60px;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 8px;
}

/* === Data Grid (Table-like) === */
.data-grid {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}

.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.data-table .actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

/* === Optimized Table Components === */
.plate-renavam-stack {
    display: flex;
    flex-direction: column;
}

.btn-copy-mini {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 2px 4px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
    transition: var(--transition);
}

.btn-copy-mini:hover {
    background: var(--accent-primary);
    color: white;
}

.vehicle-details-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.vehicle-details-summary .separator {
    color: var(--border-color);
    font-weight: 300;
}

.actions-wrapper {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
}

.btn-action {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    position: relative;
    padding: 0;
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
    border-color: var(--text-secondary);
}

.btn-action mark {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent-primary);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 10px;
    border: 2px solid var(--bg-card);
}

.btn-edit:hover { background: var(--accent-info-bg); color: var(--accent-info); }
.btn-photos:hover { background: var(--accent-info-bg); color: var(--accent-info); }
.btn-cost:hover { background: var(--accent-warning-bg); color: var(--accent-warning); }
.btn-whatsapp:hover { background: #25D366; color: white; }
.btn-pdf:hover { background: var(--accent-primary-bg); color: var(--accent-primary); }
.btn-delete:hover { background: var(--accent-danger-bg); color: var(--accent-danger); }

/* === Copy Button === */
.btn-copy {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-left: 6px;
    transition: var(--transition);
    vertical-align: middle;
}

.btn-copy:hover {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
    transform: scale(1.1);
}

/* === Status Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success {
    background: var(--accent-success-bg);
    color: var(--accent-success);
}

.badge-danger {
    background: var(--accent-danger-bg);
    color: var(--accent-danger);
}

.badge-warning {
    background: var(--accent-warning-bg);
    color: var(--accent-warning);
}

.badge-info {
    background: var(--accent-info-bg);
    color: var(--accent-info);
}

.badge-purple {
    background: var(--accent-purple-bg);
    color: var(--accent-purple);
}

.badge-muted {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
}

.badge-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

/* === Photo Gallery === */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.photo-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4/3;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: var(--transition);
}

.photo-card img:hover {
    transform: scale(1.05);
}

.photo-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.photo-card:hover .photo-delete {
    opacity: 1;
}

/* === Alert Cards === */
.alerts-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
}

.alert-item.alert-danger {
    background: var(--accent-danger-bg);
    color: var(--accent-danger);
    border-left: 3px solid var(--accent-danger);
}

.alert-item.alert-warning {
    background: var(--accent-warning-bg);
    color: var(--accent-warning);
    border-left: 3px solid var(--accent-warning);
}

/* === Modal === */
.modal {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.modal-close:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

/* === Toast === */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideIn 0.3s ease;
    min-width: 280px;
}

.toast.success {
    border-left: 4px solid var(--accent-success);
}

.toast.error {
    border-left: 4px solid var(--accent-danger);
}

.toast.warning {
    border-left: 4px solid var(--accent-warning);
}

.toast.info {
    border-left: 4px solid var(--accent-info);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* === Financial Filters === */
.financial-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    align-items: center;
}

.financial-filters .input-select {
    max-width: 200px;
}

/* === Empty State === */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state h3 {
    font-size: 16px;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 13px;
}

/* === Filter Group === */
.filter-group {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* === Pagination === */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid var(--border-color);
}

.pagination .btn {
    min-width: 36px;
    padding: 8px 12px;
}

.pagination .page-info {
    font-size: 12px;
    color: var(--text-secondary);
}

/* === Responsive === */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .stats-5 {
        grid-template-columns: repeat(3, 1fr);
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close {
        display: block;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .main-content {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .topbar {
        padding: 0 16px;
    }

    .page-container {
        padding: 16px;
    }

    .stats-grid,
    .stats-3,
    .stats-5 {
        grid-template-columns: 1fr 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .form-group.full-width {
        grid-column: span 1;
    }

    .finance-summary {
        flex-direction: column;
    }

    .page-actions {
        flex-direction: column;
    }

    .page-actions .btn {
        width: 100%;
    }

    .input-search {
        max-width: 100%;
    }

    .financial-filters {
        flex-direction: column;
    }

    .financial-filters .input-select {
        max-width: 100%;
    }

    .modal-content {
        max-width: 100%;
        margin: 10px;
    }

    .data-table {
        font-size: 12px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 10px;
    }

    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {

    .stats-grid,
    .stats-3,
    .stats-5 {
        grid-template-columns: 1fr;
    }

    .stat-value {
        font-size: 20px;
    }
}

/* === Vehicle Card Grid === */
.vehicle-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.vehicle-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: var(--transition);
    cursor: pointer;
}

.vehicle-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.vehicle-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.vehicle-card-title {
    font-weight: 700;
    font-size: 15px;
}

.vehicle-card-plate {
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 600;
    letter-spacing: 1px;
}

.vehicle-card-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.vehicle-card-detail {
    display: flex;
    flex-direction: column;
}

.vehicle-card-detail .label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vehicle-card-detail .value {
    font-size: 13px;
    font-weight: 500;
}

.vehicle-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

/* === Reorder Photos === */
.photo-reorder-group {
    position: absolute;
    bottom: 8px;
    left: 8px;
    display: flex;
    gap: 4px;
    z-index: 10;
}

.photo-move {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 4px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    transition: var(--transition);
}

.photo-move:hover {
    background: var(--accent-info);
    transform: scale(1.1);
}

.photo-badge-cover {
    position: absolute;
    top: 8px;
    left: 8px;
    background: var(--accent-warning);
    color: black;
    font-size: 10px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 10;
    pointer-events: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* === Confirm Dialog === */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 250;
    backdrop-filter: blur(4px);
}

.confirm-box {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 400px;
    text-align: center;
}

.confirm-box h3 {
    margin-bottom: 12px;
}

.confirm-box p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 13px;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* === Sale Modal Extra === */
.sale-form-summary {
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.sale-form-summary h4 {
    font-size: 14px;
    margin-bottom: 8px;
    color: var(--accent-primary);
}

.sale-form-summary p {
    font-size: 13px;
    color: var(--text-secondary);
}

/* === Report Cards === */
.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.report-item {
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 16px;
    text-align: center;
}

.report-item .report-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.report-item .report-value {
    font-size: 20px;
    font-weight: 700;
}

.report-item.positive .report-value {
    color: var(--accent-success);
}

.report-item.negative .report-value {
    color: var(--accent-danger);
}

.report-item.neutral .report-value {
    color: var(--accent-info);
}

/* ============================================
   FERRAMENTAS - FIPE, Simulador, Export
   ============================================ */

/* === FIPE Consultation === */
.fipe-loading {
    text-align: center;
    padding: 40px 20px;
}

.fipe-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.fipe-result {
    padding: 10px 0;
}

.fipe-header {
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.fipe-header h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.fipe-header p {
    font-size: 12px;
    color: var(--text-secondary);
}

.fipe-price-box {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(59, 130, 246, 0.08));
    border: 1px solid var(--accent-success);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    margin-bottom: 20px;
}

.fipe-price-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 6px;
}

.fipe-price-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent-success);
}

.fipe-price-ref {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}

.fipe-comparison {
    background: var(--bg-input);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 16px;
}

.fipe-comp-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

.fipe-comp-row:last-child {
    border-bottom: none;
}

.fipe-comp-diff {
    padding-top: 12px;
    margin-top: 4px;
    border-top: 2px solid var(--border-light);
    font-size: 15px;
}

.fipe-details {
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.fipe-details p {
    font-size: 12px;
    margin-bottom: 4px;
    color: var(--text-secondary);
}

.fipe-details strong {
    color: var(--text-primary);
}

.fipe-not-found {
    text-align: center;
    padding: 20px;
    background: var(--accent-warning-bg);
    border-radius: var(--radius-md);
}

.fipe-no-price {
    text-align: center;
    padding: 16px;
    background: var(--accent-info-bg);
    border-radius: var(--radius-md);
    margin-bottom: 16px;
}

.fipe-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    white-space: nowrap;
}

.fipe-above {
    background: var(--accent-danger-bg);
    color: var(--accent-danger);
}

.fipe-below {
    background: var(--accent-success-bg);
    color: var(--accent-success);
}

.fipe-average {
    background: var(--accent-warning-bg);
    color: var(--accent-warning);
}

/* === Profit Simulator === */
.sim-result-card {
    margin-top: 24px;
    padding: 24px;
    border-radius: var(--radius-lg);
    border: 2px solid;
    animation: fadeIn 0.4s ease;
}

.sim-positive {
    border-color: var(--accent-success);
    background: rgba(16, 185, 129, 0.06);
}

.sim-negative {
    border-color: var(--accent-danger);
    background: rgba(239, 68, 68, 0.06);
}

.sim-result-card h3 {
    text-align: center;
    font-size: 18px;
    margin-bottom: 20px;
}

.sim-result-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.sim-item {
    text-align: center;
    padding: 12px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.sim-highlight {
    background: rgba(255, 255, 255, 0.06);
    border: 2px solid var(--border-light);
}

.sim-label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.sim-value {
    font-weight: 700;
    font-size: 16px;
}

.sim-value.positive {
    color: var(--accent-success);
}

.sim-value.negative {
    color: var(--accent-danger);
}

.sim-breakdown {
    border-top: 1px solid var(--border-color);
    padding-top: 16px;
}

.sim-breakdown h4 {
    margin-bottom: 12px;
    font-size: 14px;
}

/* === Export Grid === */
.export-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.export-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.export-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.export-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.export-card h4 {
    font-size: 14px;
    margin-bottom: 8px;
}

.export-card p {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.4;
}

/* === Input Textarea === */
.input-textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    resize: vertical;
    transition: var(--transition);
}

.input-textarea:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

/* === Responsive: Export Grid === */
@media (max-width: 768px) {
    .export-grid {
        grid-template-columns: 1fr 1fr;
    }

    .sim-result-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .export-grid {
        grid-template-columns: 1fr;
    }

    .sim-result-grid {
        grid-template-columns: 1fr;
    }
}

/* === Plate Lookup === */
.plate-lookup-section {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(16, 185, 129, 0.05));
    border: 1px solid var(--accent-info);
    border-radius: var(--radius-md);
    padding: 16px !important;
}

/* === Login Screen === */
.login-screen {
    position: fixed;
    inset: 0;
    background: #000;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(239, 68, 68, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(59, 130, 246, 0.05) 0%, transparent 50%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.login-box {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.5s ease;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    height: 100px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: var(--radius-md);
}

.login-logo img {
    width: 100%;
    height: auto;
    object-fit: cover;
    transform: scale(1.3);
}

.login-header h3 {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.login-header p {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.login-screen .form-group {
    margin-bottom: 20px;
}

.login-screen label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.login-screen input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: var(--transition);
}

.login-screen input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.btn-block {
    width: 100%;
}

.login-error {
    background: var(--accent-danger-bg);
    color: var(--accent-danger);
    padding: 10px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 20px;
}

.login-footer {
    margin-top: 24px;
    text-align: center;
}

.login-footer a {
    color: var(--accent-info);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    transition: var(--transition);
}

.login-footer a:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.hidden {
    display: none !important;
}

.app-content-wrapper {
    height: 100vh;
    display: flex;/* === PagueVeloz Styles === */
#pv-progress-container {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: var(--radius-md);
    margin-top: 20px;
}

#pv-log {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
    background: #000 !important;
    border: 1px solid var(--border-color);
    scrollbar-width: thin;
}

#pv-log::-webkit-scrollbar {
    width: 4px;
}

.form-grid.pagueveloz-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}
}