:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --secondary: #ec4899;
    --bg-dark: #0f172a;
    --bg-panel: rgba(30, 41, 59, 0.7);
    --text-light: #f8fafc;
    --text-dim: #94a3b8;
    --border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    height: 100vh;
    overflow: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(79, 70, 229, 0.15) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(236, 72, 153, 0.15) 0%, transparent 20%);
}

/* Layout */
.app-container {
    display: flex;
    height: 100%;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: var(--bg-panel);
    backdrop-filter: blur(12px);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    color: var(--text-light);
}

.logo i {
    color: var(--primary);
    font-size: 1.8rem;
}

.nav-links {
    list-style: none;
    flex: 1;
}

.nav-links li {
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-dim);
    transition: all 0.3s ease;
}

.nav-links li:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-light);
    transform: translateX(4px);
}

.nav-links li.active {
    background: var(--gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(118, 75, 162, 0.4);
}

.footer .status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 5px;
}

.dot {
    width: 8px;
    height: 8px;
    background-color: #10b981;
    border-radius: 50%;
    box-shadow: 0 0 8px #10b981;
}

/* Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 3rem;
    position: relative;
}

section {
    max-width: 1200px;
    margin: 0 auto;
    opacity: 1;
    transition: opacity 0.4s ease;
}

.hidden-section {
    display: none;
    opacity: 0;
}

.header-hero {
    margin-bottom: 2.5rem;
}

.header-hero h1 {
    font-size: 2.5rem;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.header-hero p {
    color: var(--text-dim);
    font-size: 1.1rem;
}

/* Glass Panels */
.glass-panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2rem;
    backdrop-filter: blur(10px);
    box-shadow: var(--glass-shadow);
}

/* Contract Section */
.split-view {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    height: calc(100vh - 200px);
}

.input-card {
    display: flex;
    flex-direction: column;
}

.input-card h3, .output-card h3 {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

textarea {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    color: var(--text-light);
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    resize: none;
    margin-bottom: 1.5rem;
    outline: none;
    transition: border-color 0.3s;
}

textarea:focus {
    border-color: var(--primary);
}

.primary-btn {
    background: var(--gradient);
    border: none;
    padding: 1rem;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(118, 75, 162, 0.4);
}

.hidden {
    display: none !important;
}

.markdown-preview {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 1rem;
    height: 400px;
    overflow-y: auto;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.6;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.icon-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--text-light);
    cursor: pointer;
    transition: background 0.2s;
}

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

/* Schemes Section */
.center-view {
    max-width: 800px;
    margin: 0 auto;
}

.search-bar {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    margin-bottom: 2rem;
}

.search-bar input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-light);
    font-size: 1.1rem;
    outline: none;
}

.search-btn {
    background: var(--primary);
    border: none;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    color: white;
    cursor: pointer;
}

.cards-grid {
    display: grid;
    gap: 1.5rem;
}

.scheme-card {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s;
}

.scheme-card:hover {
    background: rgba(255, 255, 255, 0.06);
    transform: translateY(-3px);
    border-color: var(--primary);
}

.scheme-card h4 {
    color: var(--secondary);
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.scheme-card a {
    display: inline-block;
    margin-top: 1rem;
    color: var(--primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Chat Interface */
.chat-container {
    height: calc(100vh - 250px);
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.message {
    display: flex;
    gap: 1rem;
    max-width: 80%;
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.message.user .avatar {
    background: var(--secondary);
}

.bubble {
    background: rgba(255, 255, 255, 0.05);
    padding: 1rem;
    border-radius: 16px;
    border-top-left-radius: 0;
    line-height: 1.5;
}

.message.user .bubble {
    background: var(--primary);
    border-radius: 16px;
    border-top-right-radius: 0;
}

.chat-input-area {
    margin-top: 1rem;
    display: flex;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 16px;
}

.chat-input-area input {
    flex: 1;
    background: transparent;
    border: none;
    color: white;
    padding: 0.5rem;
    outline: none;
}

.send-btn {
    background: transparent;
    border: none;
    color: var(--primary);
    width: 40px;
    cursor: pointer;
    font-size: 1.2rem;
}

.send-btn:hover {
    color: var(--text-light);
}

/* Drag and Drop */
.upload-area {
    border: 2px dashed var(--border);
    text-align: center;
    padding: 4rem;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

.upload-area i {
    font-size: 3rem;
    color: var(--text-dim);
    margin-bottom: 1rem;
}

/* Loader */
.loader {
    border: 3px solid rgba(255,255,255,0.1);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #10b981;
    color: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    animation: slideIn 0.3s ease;
}

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

/* Responsive */
@media (max-width: 900px) {
    .app-container { flex-direction: column; }
    .sidebar { width: 100%; height: auto; flex-direction: row; padding: 1rem; align-items: center; justify-content: space-between; }
    .nav-links { display: flex; gap: 1rem; margin-bottom: 0; }
    .nav-links li span { display: none; }
    .logo, .footer { margin: 0; }
    .split-view { grid-template-columns: 1fr; height: auto; }
}
