:root {
    --bg-color: #000000;
    --glass-bg: rgba(28, 28, 30, 0.65);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #FFFFFF;
    --text-secondary: #8E8E93;
    --accent-color: #EF6A00; /* Clementine Orange */
    --accent-glow: rgba(239, 106, 0, 0.5);
    --error-color: #FF453A;
    
    --font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --border-radius-lg: 24px;
    --border-radius-md: 16px;
    --border-radius-sm: 10px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    background-image: radial-gradient(circle at 50% -20%, rgba(239, 106, 0, 0.15), transparent 60%);
    background-attachment: fixed;
    min-height: 100vh;
}

/* Typography */
h1 {
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.04em;
    margin-bottom: 12px;
}

h2 {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 8px;
}

h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 24px;
}

/* Glassmorphism System */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.glass-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.hidden {
    display: none !important;
}

/* Header */
header {
    padding: 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
}

.header-content {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo .dot {
    color: var(--accent-color);
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    transition: var(--transition);
}

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

/* Main Layout */
main {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 20px 40px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

/* Hero Section */
.hero-section {
    text-align: center;
    margin-top: 40px;
}

.hero-subtitle {
    color: var(--text-secondary);
    font-size: 1.05rem;
    margin-bottom: 40px;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

/* File Upload */
.upload-container {
    padding: 8px;
    border-radius: var(--border-radius-lg);
}

.file-upload-wrapper {
    position: relative;
    margin-bottom: 8px;
}

.file-upload-wrapper input[type="file"] {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 10;
}

.file-upload-ui {
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--border-radius-md);
    padding: 40px 20px;
    text-align: center;
    transition: var(--transition);
    border: 2px dashed rgba(255, 255, 255, 0.1);
}

.file-upload-wrapper:hover .file-upload-ui {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.upload-icon-container {
    width: 64px;
    height: 64px;
    background: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.upload-text {
    font-weight: 500;
    font-size: 1.1rem;
}

/* Buttons */
.action-btn-large {
    width: 100%;
    background: var(--text-primary);
    color: var(--bg-color);
    border: none;
    padding: 18px;
    border-radius: var(--border-radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.action-btn-large:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-secondary);
}

.action-btn-large:hover:not(:disabled) {
    transform: scale(0.98);
}

.primary-btn {
    width: 100%;
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 14px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.primary-btn:hover {
    background: #ff7f2a;
}

.secondary-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    padding: 14px;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.close-btn-text {
    background: none;
    border: none;
    color: var(--accent-color);
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
}

/* AI Processing Orb */
.full-screen-flex {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
}

.ai-orb-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 32px;
}

.ai-orb {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, var(--accent-color) 0%, #ff9500 100%);
    border-radius: 50%;
    z-index: 2;
    animation: pulse-core 2s infinite alternate ease-in-out;
}

.ai-orb-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--accent-color);
    border-radius: 50%;
    filter: blur(20px);
    opacity: 0.6;
    animation: pulse-glow 3s infinite alternate ease-in-out;
}

@keyframes pulse-core {
    0% { transform: translate(-50%, -50%) scale(0.9); }
    100% { transform: translate(-50%, -50%) scale(1.1); }
}

@keyframes pulse-glow {
    0% { transform: scale(0.8); opacity: 0.4; }
    100% { transform: scale(1.3); opacity: 0.8; }
}

.processing-title {
    font-size: 1.5rem;
    margin-bottom: 8px;
}

.processing-subtitle {
    color: var(--text-secondary);
}

/* Inputs & Modals */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.input-group {
    margin-bottom: 16px;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 16px;
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    transition: var(--transition);
}

input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(0, 0, 0, 0.5);
}

.help-link {
    display: inline-block;
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.modal-card {
    width: 100%;
    max-width: 400px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* Output Section */
.output-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding: 16px 20px;
}

.glass-tabs {
    display: flex;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    padding: 4px;
    margin-bottom: 16px;
}

.tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 10px;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    transition: var(--transition);
    cursor: pointer;
}

.tab-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.content-box {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 8px;
    margin-bottom: 20px;
}

.content-box::-webkit-scrollbar {
    width: 6px;
}
.content-box::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
}

.markdown-body h1, .markdown-body h2, .markdown-body h3 { margin-top: 1.5em; margin-bottom: 0.5em; font-weight: 600; }
.markdown-body h1:first-child { margin-top: 0; }
.markdown-body p { margin-bottom: 1em; }
.markdown-body ul, .markdown-body ol { margin-bottom: 1em; padding-left: 2em; }

/* Table Styling for Action Item Matrix */
.markdown-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5em;
    font-size: 0.95rem;
}

.markdown-body th {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    font-weight: 600;
    text-align: left;
    padding: 12px;
    border: 1px solid var(--glass-border);
}

.markdown-body td {
    padding: 12px;
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
}

.markdown-body tr:hover td {
    background: rgba(255, 255, 255, 0.05);
}

/* Ensure colored spans injected by LLM are visible against dark mode if they are too dark */
.markdown-body span[style*="color: #0056b3;"] {
    color: #4da3ff !important; /* Lighter Corporate Blue for dark mode */
}
.markdown-body span[style*="color: #28a745;"] {
    color: #34d058 !important; /* Lighter Emerald Green for dark mode */
}
.markdown-body span[style*="color: #dc3545;"] {
    color: #ff5555 !important; /* Lighter Crimson for dark mode */
}
.markdown-body span[style*="color: #6c757d;"] {
    color: #a0aab2 !important; /* Lighter Charcoal for dark mode */
}

.export-actions {
    display: flex;
    gap: 12px;
    border-top: 1px solid var(--glass-border);
    padding-top: 16px;
}

.export-btn {
    flex: 1;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    padding: 10px;
    border-radius: var(--border-radius-sm);
    font-weight: 500;
    cursor: pointer;
}

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

/* History */
.section-header h3 {
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    border-radius: var(--border-radius-sm);
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--glass-border);
}

.history-info {
    flex: 1;
}

.history-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.history-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.history-actions {
    display: flex;
    gap: 8px;
}

.action-btn {
    background: rgba(255,255,255,0.1);
    border: none;
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.action-btn.delete {
    color: var(--error-color);
}

.empty-state {
    color: var(--text-secondary);
    text-align: center;
    padding: 20px;
}
