:root {
    --bg-color: #050608;
    --card-bg: #0f1115;
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --text-main: #f8fafc;
    --text-muted: #64748b;
    --border: #1e293b;
    --glass: rgba(255, 255, 255, 0.03);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.hidden {
    display: none !important;
}

body {
    font-family: var(--font-body);
    background-color: #050608;
    /* User-Provided Sky Solutions Background */
    background-image:
        linear-gradient(rgba(5, 6, 8, 0.7), rgba(5, 6, 8, 0.7)),
        url('logo.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    position: relative;
    overflow-x: hidden;
}

/* Moving Atmospheric Clouds Layer */
body::before {
    content: "";
    position: fixed;
    top: 50%;
    left: 50%;
    width: 200%;
    height: 200%;
    transform: translate(-50%, -50%);
    background:
        radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.03) 0%, transparent 20%),
        radial-gradient(circle at 60% 60%, rgba(255, 255, 255, 0.02) 0%, transparent 30%);
    filter: blur(80px);
    z-index: -1;
    pointer-events: none;
    animation: clouds 100s linear infinite;
}

@keyframes clouds {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* Atmospheric Clouds / Fog (Pure CSS) */
body::after {
    content: "";
    position: fixed;
    top: 50%;
    left: 50%;
    width: 200%;
    height: 200%;
    transform: translate(-50%, -50%);
    background:
        radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.02) 0%, transparent 20%),
        radial-gradient(circle at 70% 60%, rgba(255, 255, 255, 0.01) 0%, transparent 30%);
    filter: blur(80px);
    z-index: -1;
    pointer-events: none;
    animation: atmospheric 60s linear infinite;
}

@keyframes atmospheric {
    from {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.app-container {
    width: 100%;
    max-width: 1400px;
    padding: 2rem;
    position: relative;
    z-index: 1;
}

/* Subtle texture overlay */
body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.02;
    pointer-events: none;
    z-index: 0;
}

/* Global Config Header */
.global-config-bar {
    background: rgba(15, 17, 21, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.config-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.config-item label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 700;
}

.config-item input {
    background: #000;
    border: 1px solid var(--border);
    padding: 0.6rem 1rem;
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    width: 100%;
    transition: border-color 0.2s;
}

.config-item input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.logo span {
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Phase Navigation */
.phase-nav {
    display: flex;
    gap: 0.75rem;
    background: rgba(15, 17, 21, 0.5);
    padding: 0.4rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.nav-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-btn:hover:not(:disabled) {
    color: var(--text-main);
}

.nav-btn.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.3);
}

.nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(1);
}

.lock-icon {
    font-size: 0.8rem;
    opacity: 0.7;
}

.status-indicator {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--success);
    background: rgba(16, 185, 129, 0.05);
    padding: 0.4rem 1rem;
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: 100px;
}

.phase-content {
    display: none;
}

.phase-content.active {
    display: block;
}

/* Drafting Workspace */
.workspace-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.sections-container {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-color);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
    min-height: 300px;
    max-height: 500px;
}

.draft-section-item {
    margin-bottom: 2rem;
    animation: fadeIn 0.4s ease;
}

.draft-section-item h4 {
    color: var(--primary);
    margin-bottom: 0.75rem;
    font-size: 1.1rem;
}

.draft-section-item p {
    line-height: 1.6;
    color: #e2e8f0;
}

.instructions-area {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.instructions-area textarea {
    width: 100%;
    min-height: 120px;
    background: #000;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    color: white;
    font-family: inherit;
    margin-bottom: 1rem;
    resize: vertical;
}

.instructions-area textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.sync-section {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--border);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Grid Layout */
.grid-container {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 2.5rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .grid-container {
        grid-template-columns: 1fr;
    }
}

/* Cards */
.card {
    background: rgba(15, 17, 21, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 16px;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    transition: transform 0.2s, border-color 0.2s;
}

.card:hover {
    border-color: rgba(139, 92, 246, 0.3);
}

h2 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    line-height: 1.5;
}

/* Form Elements */
.file-group {
    margin-bottom: 2rem;
}

label {
    display: block;
    margin-bottom: 0.75rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.file-drop-zone {
    border: 1px dashed var(--border);
    border-radius: 12px;
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background: rgba(0, 0, 0, 0.2);
}

.file-drop-zone:hover,
.file-drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(139, 92, 246, 0.05);
}

.file-drop-zone .icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 10px rgba(139, 92, 246, 0.3));
}

.file-drop-zone .text {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.file-name {
    margin-top: 1rem;
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 600;
    word-break: break-all;
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(139, 92, 246, 0.5);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--border);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--text-muted);
}

/* Results Section Enhancement */
.results-card {
    min-height: 600px;
    display: flex;
    flex-direction: column;
}

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
}

.empty-state .illustration {
    font-size: 5rem;
    margin-bottom: 2rem;
    filter: grayscale(1) opacity(0.2);
}

.empty-state h3 {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.empty-state p {
    color: var(--text-muted);
    max-width: 400px;
    margin: 0 auto;
}

/* Success Header */
.success-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

/* Table Refinement */
.table-container {
    border-radius: 12px;
    border: 1px solid var(--border);
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    background: rgba(255, 255, 255, 0.02);
    padding: 1rem;
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
    color: var(--text-muted);
}

td {
    padding: 1rem;
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-main);
    vertical-align: top;
}

tr:hover td {
    background: rgba(139, 92, 246, 0.03);
}

/* Markdown Support in Table */
td br {
    margin-bottom: 0.5rem;
}

/* Badges */
.badge {
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Chat Section Professionalism */
.chat-section {
    margin-top: 3rem;
}

.chat-panel {
    background: rgba(0, 0, 0, 0.2);
    padding: 2rem;
    border-top: 1px solid var(--border);
}

.chat-messages {
    background: #000;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    height: 400px;
}

.chat-message {
    padding: 1rem 1.25rem;
    border-radius: 12px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.chat-message.user {
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 2px;
}

.chat-message.assistant {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-bottom-left-radius: 2px;
}

/* Spinner */
.spinner {
    display: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading .spinner {
    display: block;
}

.loading .btn-text {
    display: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}