/* ============================================
   XML to World Office - Enterprise ERP Style
   Professional Corporate Design System v2
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    /* Corporate Color Palette */
    --header-bg: #1e293b;
    --header-text: #94a3b8;
    --header-text-active: #ffffff;

    --bg-main: #f1f5f9;
    --bg-card: #ffffff;

    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    --border-color: #e2e8f0;

    --accent-primary: #0ea5e9;
    --accent-hover: #0284c7;
    --accent-light: #e0f2fe;

    --success: #22c55e;
    --success-light: #dcfce7;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;

    /* Dimensions */
    --header-height: 52px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 2px 4px -1px rgb(0 0 0 / 0.1);

    /* Border Radius - Minimal */
    --radius-sm: 2px;
    --radius-md: 4px;

    /* Transitions */
    --transition: 150ms ease;
}

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

html,
body {
    height: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-primary);
    background: var(--bg-main);
    -webkit-font-smoothing: antialiased;
}

/* ============================================
   Layout Structure
   ============================================ */
.app-layout {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ============================================
   Top Navigation Bar (Header)
   ============================================ */
.top-nav {
    height: var(--header-height);
    background: var(--header-bg);
    display: flex;
    align-items: center;
    padding: 0 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--header-text-active);
    text-decoration: none;
    margin-right: 32px;
}

.nav-brand .logo-icon {
    width: 28px;
    height: 28px;
    background: var(--accent-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-brand .logo-icon .material-icons {
    font-size: 18px;
    color: white;
}

.nav-brand span {
    font-weight: 600;
    font-size: 14px;
    letter-spacing: -0.3px;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--header-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: all var(--transition);
}

.nav-item .material-icons {
    font-size: 18px;
    opacity: 0.8;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--header-text-active);
}

.nav-item.active {
    background: rgba(14, 165, 233, 0.2);
    color: var(--accent-primary);
}

.nav-item.active .material-icons {
    opacity: 1;
}

.nav-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 8px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.nav-credits {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background: rgba(14, 165, 233, 0.15);
    border-radius: var(--radius-sm);
    font-size: 12px;
    color: var(--accent-primary);
}

.nav-credits .material-icons {
    font-size: 16px;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    color: var(--header-text);
    transition: background var(--transition);
}

.nav-user:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-user-avatar {
    width: 28px;
    height: 28px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-user-avatar .material-icons {
    font-size: 18px;
    color: var(--header-text);
}

.nav-user-name {
    font-size: 12px;
    color: var(--header-text-active);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-logout {
    color: var(--header-text);
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}

.nav-logout:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--header-text-active);
}

.nav-logout .material-icons {
    font-size: 18px;
}

/* ============================================
   Main Content Area
   ============================================ */
.main-content {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Page Header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.page-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.card-header {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-title .material-icons {
    font-size: 16px;
    color: var(--text-secondary);
}

.card-body {
    padding: 14px;
}

.card-body.no-padding {
    padding: 0;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 12px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

.btn .material-icons {
    font-size: 16px;
}

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

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

.btn-secondary {
    background: var(--bg-main);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

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

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

.btn-danger:hover {
    background: #dc2626;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 11px;
}

.btn-sm .material-icons {
    font-size: 14px;
}

/* ============================================
   Stats Row
   ============================================ */
.stats-row {
    display: flex;
    gap: 12px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 160px;
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon.primary {
    background: var(--accent-light);
    color: var(--accent-primary);
}

.stat-icon.success {
    background: var(--success-light);
    color: var(--success);
}

.stat-icon.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.stat-icon .material-icons {
    font-size: 20px;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
}

/* ============================================
   Dropzone - Compact
   ============================================ */
.dropzone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 32px 16px;
    text-align: center;
    background: var(--bg-card);
    cursor: pointer;
    transition: all var(--transition);
}

.dropzone:hover,
.dropzone.dragover {
    border-color: var(--accent-primary);
    background: var(--accent-light);
}

.dropzone-content .material-icons {
    font-size: 36px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.dropzone:hover .dropzone-content .material-icons,
.dropzone.dragover .dropzone-content .material-icons {
    color: var(--accent-primary);
}

.dropzone-content h2 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.dropzone-content p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ============================================
   Tables - COMPACT
   ============================================ */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

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

.data-table th {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--text-secondary);
    background: #f8fafc;
    position: sticky;
    top: 0;
}

.data-table td {
    font-size: 11px;
    color: var(--text-primary);
}

.data-table tbody tr:hover {
    background: #f8fafc;
}

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

/* Table inputs - Compact */
.data-table input {
    width: 100%;
    padding: 4px 6px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-family: inherit;
    background: white;
    transition: border-color var(--transition);
}

.data-table input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.data-table input.missing,
.data-table input.input-required-empty {
    border-color: var(--danger);
    background: var(--danger-light);
}

/* Results Container */
.results-container {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

/* ============================================
   Company Sections
   ============================================ */
.company-section {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 12px;
    overflow: hidden;
}

.company-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--header-bg);
    color: white;
}

.company-title {
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.company-title .material-icons {
    font-size: 16px;
    opacity: 0.8;
}

.create-company-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    padding: 4px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: background var(--transition);
}

.create-company-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.create-company-btn .material-icons {
    font-size: 14px;
}

.company-section .results-container {
    border: none;
    border-radius: 0;
}

/* ============================================
   Status Indicators
   ============================================ */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 10px;
    font-weight: 500;
}

.status-badge.success {
    background: var(--success-light);
    color: var(--success);
}

.status-badge.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.status-badge.danger {
    background: var(--danger-light);
    color: var(--danger);
}

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-dot.status-new {
    background: var(--danger);
}

.status-dot.status-known {
    background: var(--success);
}

/* Row States */
.row-new {
    background: var(--warning-light) !important;
}

.row-locked {
    opacity: 0.6;
    background: #f5f5f5 !important;
}

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

/* ============================================
   Form Elements
   ============================================ */
.form-group {
    margin-bottom: 12px;
}

.form-label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.form-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: white;
    transition: all var(--transition);
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

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

/* ============================================
   Actions Bar
   ============================================ */
.actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 12px;
}

/* ============================================
   Utility Classes
   ============================================ */
.hidden {
    display: none !important;
}

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

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

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

/* ============================================
   Scrollbar - Minimal
   ============================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {

    .nav-brand span,
    .nav-user-name {
        display: none;
    }

    .nav-item span {
        display: none;
    }

    .stats-row {
        flex-wrap: wrap;
    }

    .stat-card {
        min-width: 140px;
        flex: 1;
    }
}

/* ============================================
   Welcome Modal
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: all 0.3s ease;
}

.modal-content {
    background: white;
    border-radius: 8px;
    padding: 32px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.welcome-header {
    text-align: center;
    margin-bottom: 24px;
}

.welcome-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.welcome-features {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.w-feature {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.w-feature .material-icons {
    font-size: 24px;
    margin-top: 2px;
}

.w-feature strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.w-feature p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0;
}

.animate-pop {
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.btn-lg {
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 600;
}