/* ============================================
   BASE.css - Reset, Variables, Body, Loading Screen, Typography
   ============================================
   Contains:
   - CSS Reset
   - CSS Variables (color scheme)
   - Body and html base styles
   - Loading screen and animations
   - Container and main layout
   - Typography basics
   ============================================ */

/* PDF to Excel - Styles */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; min-height: 100vh; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f7fa; min-height: 100vh; display: flex; flex-direction: column; align-items: center; }

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}
.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}
.loading-logo-img {
    width: 80px;
    height: 80px;
    margin-bottom: 1rem;
    animation: bounce 1s ease-in-out infinite;
    object-fit: contain;
}
@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-15px); }
}
.loading-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: #6d28d9;
    margin-bottom: 1rem;
}
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #c4b5fd;
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Usage info card (below upload section) */
.usage-info-card { 
    margin-top: 1rem; 
    padding: 0.75rem 1rem; 
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%); 
    border-radius: 8px; 
    text-align: center;
    border: 1px solid #c4b5fd;
}
.usage-info-card span { 
    font-size: 0.85rem; 
    color: #6d28d9; 
    font-weight: 500; 
}
.usage-info-card.logged-in { 
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%); 
    border-color: #6ee7b7;
}
.usage-info-card.logged-in span { 
    color: #047857; 
}

/* Offline Indicator */
.offline-indicator { position: fixed; bottom: 1rem; left: 1rem; padding: 0.75rem 1rem; border-radius: 8px; font-size: 0.8rem; font-weight: 500; z-index: 1000; display: none; }
.offline-indicator.offline { background: #ef4444; color: white; display: flex; align-items: center; gap: 0.5rem; }
.offline-indicator.ready { background: #10b981; color: white; display: flex; align-items: center; gap: 0.5rem; }

.container { max-width: 1400px; margin: 0 auto; padding: 2rem; }

/* Main Layout - 3 columns */
.main-layout { display: grid; grid-template-columns: 280px 1fr 280px; gap: 1.5rem; }

/* Intro Section */
.intro-section { background: white; border-radius: 16px; padding: 2rem; margin-bottom: 1.5rem; color: #374151; border: 1px solid #e5e7eb; box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.intro-header { display: flex; justify-content: center; align-items: center; cursor: pointer; user-select: none; position: relative; }
.intro-header:hover .intro-title { color: #6d28d9; }
.intro-toggle-icon { position: absolute; right: 0; font-size: 1.25rem; color: #7c3aed; transition: transform 0.3s ease; }
.intro-section.collapsed .intro-toggle-icon { transform: rotate(-90deg); }
.intro-content { overflow: hidden; transition: max-height 0.3s ease, opacity 0.3s ease; }
.intro-section.collapsed .intro-content { max-height: 0; opacity: 0; margin-top: 0; }
.intro-section:not(.collapsed) .intro-content { max-height: 1000px; opacity: 1; margin-top: 1rem; }
.intro-title { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.25rem; text-align: center; color: #7c3aed; transition: color 0.2s; }
.intro-subtitle { font-size: 1.1rem; color: #6b7280; text-align: center; margin-bottom: 0; }
.steps-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-top: 1rem; }
.step-card { background: #f9fafb; border-radius: 12px; padding: 1.5rem 1rem 1.25rem; text-align: center; position: relative; border: 1px solid #e5e7eb; }
.step-number { position: absolute; top: -13px; left: 50%; transform: translateX(-50%); background: #7c3aed; color: white; width: 26px; height: 26px; border-radius: 50%; font-size: 0.85rem; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 4px rgba(124, 58, 237, 0.3); }
.step-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.step-title { font-size: 1.1rem; font-weight: 600; margin-bottom: 0.35rem; color: #374151; }
.step-desc { font-size: 0.9rem; color: #4b5563; line-height: 1.4; }
.step-detail { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid #e5e7eb; text-align: left; }
.step-detail-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; margin-bottom: 0.5rem; color: #374151; }
.step-detail-icon { width: 22px; height: 22px; background: #f5f3ff; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 0.75rem; }
.highlight-demo { display: flex; align-items: center; gap: 0.25rem; margin-top: 0.5rem; }
.highlight-box-demo { flex: 1; height: 14px; background: #f3f4f6; border-radius: 2px; border: 1px dashed #d1d5db; }
.highlight-box-demo.filled { background: rgba(124, 58, 237, 0.3); border-style: solid; border-color: #7c3aed; }

/* Section separator */
.template-section { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid #e5e7eb; }

/* Info Banner */
.info-banner { background: #f5f3ff; border: 1px solid #c4b5fd; border-radius: 6px; padding: 0.5rem 1rem; margin-bottom: 1rem; font-size: 0.8rem; color: #6d28d9; display: none; }
.info-banner.active { display: flex; align-items: center; gap: 0.5rem; }

/* CSS Variables - Color Scheme */
:root {
    --bg-primary: #f5f7fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f9fafb;
    --text-primary: #374151;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;
    --border-color: #e5e7eb;
    --border-light: #d1d5db;
    --accent-light: #f5f3ff;
    --accent-border: #c4b5fd;
    --shadow-color: rgba(0,0,0,0.1);
}

.dark-mode {
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-tertiary: #374151;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --text-muted: #9ca3af;
    --border-color: #374151;
    --border-light: #4b5563;
    --accent-light: #2d2640;
    --accent-border: #5b21b6;
    --shadow-color: rgba(0,0,0,0.3);
}

/* Dark mode body */
.dark-mode body {
    background: var(--bg-primary);
}

/* Transition for smooth mode switching */
body, .card, .dashboard, .intro-section, .modal, input, select, textarea,
.btn, .pdf-item, .field-item, .stat-card, .step-card, .template-item,
.history-item, .admin-message-item, .admin-user-item {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
