/* -------------------------------------------------------------
 * GF Simples Auditor - Custom Styling & Design System
 * ------------------------------------------------------------- */

/* Design Tokens */
:root {
    --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --font-mono: 'Courier Prime', monospace;
    
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
    --border-radius-sm: 6px;
    
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
}

/* Themes */
.dark-theme {
    --bg-app: #080b11;
    --bg-ambient-1: rgba(99, 102, 241, 0.12);
    --bg-ambient-2: rgba(59, 130, 246, 0.12);
    
    --card-bg: rgba(17, 24, 39, 0.7);
    --card-border: rgba(255, 255, 255, 0.06);
    --card-hover-border: rgba(99, 102, 241, 0.3);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-primary: #6366f1;
    --accent-primary-hover: #4f46e5;
    --accent-secondary: #3b82f6;
    
    --input-bg: rgba(15, 23, 42, 0.8);
    --input-border: rgba(255, 255, 255, 0.08);
    --input-focus-border: #6366f1;
    
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
}

.light-theme {
    --bg-app: #f1f5f9;
    --bg-ambient-1: rgba(99, 102, 241, 0.06);
    --bg-ambient-2: rgba(59, 130, 246, 0.06);
    
    --card-bg: rgba(255, 255, 255, 0.8);
    --card-border: rgba(0, 0, 0, 0.06);
    --card-hover-border: rgba(99, 102, 241, 0.25);
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --accent-primary: #4f46e5;
    --accent-primary-hover: #3730a3;
    --accent-secondary: #2563eb;
    
    --input-bg: rgba(255, 255, 255, 0.9);
    --input-border: rgba(0, 0, 0, 0.08);
    --input-focus-border: #4f46e5;
    
    --success: #059669;
    --danger: #dc2626;
    --warning: #d97706;
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Ambient glow backgrounds */
.ambient-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    z-index: -1;
    pointer-events: none;
}

.glow-1 {
    top: -10%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: var(--bg-ambient-1);
}

.glow-2 {
    bottom: -10%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: var(--bg-ambient-2);
}

.app-container {
    width: 100%;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    z-index: 1;
}

/* Header styling */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--card-border);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius-md);
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

.logo-text h1 {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-primary);
}

.logo-text h1 span {
    color: var(--accent-primary);
}

.logo-text p {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 2px;
}

.logo-text p a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
}

.logo-text p a:hover {
    color: var(--accent-primary);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Buttons styling */
.btn-icon {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    width: 40px;
    height: 40px;
    border-radius: var(--border-radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-fast);
}

.btn-icon:hover {
    border-color: var(--card-hover-border);
    color: var(--text-primary);
    transform: translateY(-1px);
}

.btn-icon svg {
    width: 20px;
    height: 20px;
}

.light-theme .btn-icon .sun-icon,
.dark-theme .btn-icon .moon-icon {
    display: none;
}

.btn-secondary {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: var(--border-radius-sm);
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition-fast);
}

.btn-secondary:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Main layout content */
.main-content {
    display: flex;
    flex-direction: column;
}

/* Upload zone */
.upload-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: fadeIn 0.4s ease;
}

.upload-card {
    background: var(--card-bg);
    border: 2px dashed var(--input-border);
    border-radius: var(--border-radius-lg);
    padding: 48px 32px;
    text-align: center;
    width: 100%;
    cursor: pointer;
    transition: var(--transition-smooth);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    position: relative;
    backdrop-filter: blur(12px);
}

.upload-card:hover, .upload-card.dragover {
    border-color: var(--accent-primary);
    box-shadow: 0 0 24px rgba(99, 102, 241, 0.1);
}

.hidden-file-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

.upload-icon-wrapper {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-icon {
    width: 32px;
    height: 32px;
}

.upload-card h2 {
    font-size: 20px;
    font-weight: 700;
}

.upload-card p {
    font-size: 13px;
    color: var(--text-secondary);
}

.upload-note {
    font-size: 11px;
    color: var(--text-muted);
}

/* Disclaimer & Criteria Panel Styles */
.disclaimer-panel {
    background-color: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    max-width: 800px;
    width: 100%;
    box-sizing: border-box;
    margin: 20px auto 0 auto;
    backdrop-filter: blur(12px);
}

.disclaimer-panel .panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 10px;
}

.disclaimer-panel .panel-header svg {
    color: var(--accent-primary);
    width: 20px;
    height: 20px;
}

.disclaimer-panel .panel-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.disclaimer-panel p {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 20px;
}

.criteria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.criteria-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: var(--border-radius-md);
    padding: 14px;
}

.criteria-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    color: var(--accent-primary);
    flex-shrink: 0;
}

.criteria-icon svg {
    width: 18px;
    height: 18px;
}

.criteria-text h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.criteria-text p {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    margin: 0;
}

.legal-notice {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.5;
    background: rgba(245, 158, 11, 0.05);
    border-left: 3px solid #f59e0b;
    padding: 10px 14px;
    border-radius: 4px;
}


/* Workspace Section */
.preview-section {
    animation: fadeIn 0.4s ease;
}

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

.nf-summary-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.badge-nfe {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
}

.nf-summary-title h2 {
    font-size: 18px;
    font-weight: 800;
}

.action-buttons {
    display: flex;
    gap: 12px;
}

/* Dashboard Statistics Grid */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    backdrop-filter: blur(10px);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-primary);
    background: rgba(99, 102, 241, 0.05);
    flex-shrink: 0;
}

.stat-icon svg {
    width: 22px;
    height: 22px;
}

.stat-info h3 {
    font-size: 20px;
    font-weight: 800;
}

.stat-info p {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    margin-top: 2px;
}

/* Cards & Informational layouts */
.info-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    backdrop-filter: blur(12px);
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title svg {
    width: 18px;
    height: 18px;
    color: var(--accent-primary);
}

.card-title h3 {
    font-size: 14px;
    font-weight: 700;
}

/* Tables styling */
.card-header-table {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.table-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-title svg {
    width: 18px;
    height: 18px;
    color: var(--accent-primary);
}

.table-title h3 {
    font-size: 14px;
    font-weight: 700;
}

.products-count {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    background: var(--input-bg);
}

.styled-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.styled-table th {
    background: rgba(255, 255, 255, 0.01);
    color: var(--text-secondary);
    font-weight: 700;
    padding: 12px 16px;
    font-size: 11px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--card-border);
}

.styled-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--card-border);
    color: var(--text-primary);
}

.styled-table tbody tr:last-child td {
    border-bottom: none;
}

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

.styled-table .center {
    text-align: center;
}

.styled-table .right {
    text-align: right;
}

.styled-table td.right {
    font-weight: 600;
}

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

/* Compliance alerts styling */
.compliance-alert {
    display: flex;
    gap: 12px;
    padding: 14px;
    border-radius: var(--border-radius-md);
    background: rgba(239, 68, 68, 0.03);
    border: 1px solid rgba(239, 68, 68, 0.12);
    font-size: 12px;
    line-height: 1.5;
}

.compliance-alert.warning {
    background: rgba(245, 158, 11, 0.03);
    border-color: rgba(245, 158, 11, 0.12);
}

.compliance-icon {
    color: #ef4444;
    flex-shrink: 0;
    margin-top: 1px;
}

.compliance-alert.warning .compliance-icon {
    color: #f59e0b;
}

.compliance-icon svg {
    width: 16px;
    height: 16px;
}

.compliance-text strong {
    font-weight: 700;
    display: block;
    margin-bottom: 2px;
    color: var(--text-primary);
}

.compliance-text span {
    color: var(--text-secondary);
}

/* Notification Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background-color: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    padding: 12px 20px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
    z-index: 100000;
    animation: slideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.toast-icon {
    width: 16px;
    height: 16px;
    color: #10b981;
}

/* Helper Utilities */
.hidden {
    display: none !important;
}

/* Keyframes animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Footer styling */
.app-footer {
    text-align: center;
    border-top: 1px solid var(--card-border);
    padding-top: 20px;
    margin-top: auto;
}

.app-footer p {
    font-size: 12px;
    color: var(--text-muted);
}

.app-footer p a {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 600;
}

.app-footer p a:hover {
    color: var(--accent-primary);
}

/* Print thermal styling override layout */
@media print {
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    .app-header,
    .upload-section,
    .action-bar,
    .tab-navigation,
    .compliance-alert {
        display: none !important;
    }
}

/* Custom Scrollbar Styles */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    border: 2px solid transparent;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* Light Theme overrides for scrollbar */
.light-theme ::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border: 2px solid transparent;
    background-clip: padding-box;
}

.light-theme ::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid transparent;
    background-clip: padding-box;
}

/* Firefox scrollbar support */
html {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

.light-theme {
    scrollbar-color: rgba(0, 0, 0, 0.15) transparent;
}
