:root {
    --bg-color: #0f172a;
    --surface-color: rgba(30, 41, 59, 0.7);
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --accent-color: #f43f5e;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, hsla(253,16%,7%,1) 0, transparent 50%), 
        radial-gradient(at 50% 0%, hsla(225,39%,30%,1) 0, transparent 50%), 
        radial-gradient(at 100% 0%, hsla(339,49%,30%,1) 0, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Navbar */
.navbar {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--glass-border);
    height: 70px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo i {
    color: var(--primary-color);
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
}

.btn-outline:hover {
    background: var(--glass-bg);
}

.btn-edit { background: #0ea5e9; color: white; }
.btn-delete { background: var(--accent-color); color: white; }

/* Main Content */
.main-content {
    padding-top: 40px;
    padding-bottom: 80px;
}

.view {
    animation: fadeIn 0.5s ease-out;
}

.view.hidden {
    display: none;
}

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

/* Board List */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.search-bar {
    position: relative;
    margin-bottom: 30px;
}

.search-bar input {
    width: 100%;
    padding: 15px 20px 15px 45px;
    background: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: white;
    font-size: 1rem;
    outline: none;
}

.search-bar i {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.board-table-wrapper {
    background: var(--surface-color);
    backdrop-filter: blur(12px);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    overflow: hidden;
}

.board-table {
    width: 100%;
    border-collapse: collapse;
}

.board-table th {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px 20px;
    text-align: left;
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.board-table td {
    padding: 15px 20px;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.95rem;
}

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

.board-table tr {
    cursor: pointer;
    transition: var(--transition);
}

.board-table tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.post-title-cell {
    font-weight: 500;
}

/* Post Detail */
.post-detail-card {
    background: var(--surface-color);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    padding: 40px;
    margin-bottom: 30px;
}

.post-header {
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 20px;
    margin-bottom: 30px;
}

.post-header h2 {
    font-size: 2rem;
    margin-bottom: 15px;
}

.post-meta {
    display: flex;
    gap: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.post-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.post-body {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #e2e8f0;
    min-height: 200px;
    white-space: pre-wrap;
}

.post-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--glass-border);
}

.post-actions {
    display: flex;
    justify-content: space-between;
}

/* Comments */
.comments-section {
    margin-top: 40px;
}

.comments-section h3 {
    margin-bottom: 20px;
}

.comment-item {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.9rem;
}

.comment-author { font-weight: 600; color: var(--primary-color); }
.comment-date { color: var(--text-secondary); }

.comment-form {
    margin-top: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.comment-form textarea {
    background: var(--surface-color);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 15px;
    color: white;
    resize: none;
    outline: none;
}

/* Auth Card */
.auth-card {
    max-width: 400px;
    margin: 60px auto;
    background: var(--surface-color);
    backdrop-filter: blur(12px);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    padding: 30px;
}

.auth-tabs {
    display: flex;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--glass-border);
}

.auth-tab {
    flex: 1;
    padding: 15px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-weight: 600;
}

.auth-tab.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 12px 15px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: white;
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary-color);
}

.btn-block {
    width: 100%;
    justify-content: center;
    padding: 15px;
}

/* --- Hero Section --- */
.hero-section {
    padding: 100px 0 60px;
    background: radial-gradient(circle at 80% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 40%),
                radial-gradient(circle at 20% 80%, rgba(168, 85, 247, 0.1) 0%, transparent 40%);
    overflow: hidden;
}

.hero-content {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 60px;
    align-items: center;
}

.hero-text .badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 24px;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.hero-text h1 {
    font-family: 'Outfit', sans-serif;
    font-size: 4rem;
    line-height: 1.1;
    margin-bottom: 24px;
    font-weight: 800;
}

.hero-text p {
    font-size: 1.2rem;
    color: var(--text-dim);
    line-height: 1.6;
    margin-bottom: 40px;
}

.hero-actions {
    display: flex;
    gap: 16px;
}

.gradient-text {
    background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-image img {
    width: 100%;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.floating {
    animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
    100% { transform: translateY(0px); }
}

/* --- AI Chatbot Widget --- */
.chat-widget {
    position: fixed;
    bottom: 30px;
    left: 30px; /* Moved to left to avoid overlapping with log panel */
    z-index: 1000;
}

.chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.chat-toggle:hover {
    transform: scale(1.1);
}

.notification-dot {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 12px;
    height: 12px;
    background: #ef4444;
    border: 2px solid #0f172a;
    border-radius: 50%;
}

.chat-window {
    position: absolute;
    bottom: 80px;
    left: 0; /* Align to left of toggle */
    width: 380px;
    height: 500px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.chat-window.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.chat-header {
    padding: 20px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    gap: 15px;
}

.ai-avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.ai-status h3 {
    font-size: 1rem;
    margin-bottom: 2px;
}

.status-online {
    font-size: 0.75rem;
    color: #10b981;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-online::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #10b981;
    border-radius: 50%;
}

.chat-close {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1.2rem;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.message.ai {
    align-self: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-bottom-left-radius: 4px;
}

.message.user {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-input-area {
    padding: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-top: 1px solid var(--glass-border);
    display: flex;
    gap: 10px;
}

.chat-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 10px 15px;
    color: white;
    outline: none;
}

.chat-input-area button {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--primary);
    border: none;
    color: white;
    cursor: pointer;
    transition: transform 0.2s;
}

.chat-input-area button:hover {
    transform: scale(1.05);
}

/* --- Toast Notification --- */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    padding: 12px 24px;
    border-radius: 100px;
    color: white;
    font-weight: 500;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 2000;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

/* --- App Layout (Main + Sidebar) --- */
.app-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 30px;
    margin-top: 30px;
    margin-bottom: 60px;
}

@media (max-width: 992px) {
    .app-layout {
        grid-template-columns: 1fr;
    }
}

/* --- Transaction Log Panel --- */
.log-panel {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    position: sticky;
    top: 90px;
    overflow: hidden;
}

.log-header {
    padding: 15px 20px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.log-header h3 {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 1px;
}

.btn-clear-log {
    background: none;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.btn-clear-log:hover {
    color: #ef4444;
}

.log-content {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.log-item {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border-left: 3px solid #64748b;
    animation: slideIn 0.3s ease-out;
}

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

.log-item .time {
    color: var(--text-dim);
    margin-right: 8px;
    font-weight: normal;
}

.log-item.select { border-left-color: #3b82f6; color: #93c5fd; }
.log-item.insert { border-left-color: #10b981; color: #6ee7b7; }
.log-item.update { border-left-color: #f59e0b; color: #fcd34d; }
.log-item.delete { border-left-color: #ef4444; color: #fca5a5; }
.log-item.system { border-left-color: #a855f7; color: #d8b4fe; }

/* Custom scrollbar for logs */
.log-content::-webkit-scrollbar {
    width: 6px;
}

.log-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

/* --- Responsive Adjustments --- */
@media (max-width: 992px) {
    .hero-content {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 40px;
    }
    .hero-text h1 { font-size: 3rem; }
    .hero-actions { justify-content: center; }
    .hero-image { order: -1; }
}

@media (max-width: 576px) {
    .chat-window {
        width: calc(100vw - 40px);
        right: -10px;
    }
    .hero-text h1 { font-size: 2.5rem; }
}

.hidden { display: none !important; }
