/* Sarangbi Rain Studio - K-Drama Aesthetic */

@import url('https://fonts.googleapis.com/css2?family=Noto+Serif:wght@300;400;600&family=Noto+Sans+KR:wght@300;400;500&display=swap');

:root {
    /* K-Drama Earth Tones */
    --primary: #8b7d6b;
    --primary-dark: #6b5d4b;
    --secondary: #a89988;
    --success: #7a9b7e;
    --danger: #b87873;
    --warning: #c4a574;
    --info: #8d9aad;

    /* Warm Cream Backgrounds */
    --bg-light: #f8f4eb;
    --bg-gray: #f5f0e6;
    --bg-card: #fffcf7;
    --bg-hover: #faf6ef;

    /* Muted Text */
    --text-dark: #4a4a4a;
    --text-medium: #6b6b6b;
    --text-muted: #a89988;

    /* Warm Tan Borders */
    --border: #e5ddd0;
    --border-light: #d4c4b0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Serif', serif;
    background: var(--bg-light);
    color: var(--text-dark);
    min-height: 100vh;
    line-height: 1.7;
    font-weight: 300;
}

/* Navigation Bar - Minimal K-Drama Style */
.navbar {
    background: rgba(248, 244, 235, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--primary);
    font-weight: 400;
    font-size: 1.1rem;
    font-family: 'Noto Sans KR', sans-serif;
    letter-spacing: 0.05rem;
}

.navbar-brand .logo {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #8b7d6b, #a89988);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    font-weight: 300;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 6px;
    list-style: none;
}

.navbar-menu a {
    color: var(--text-muted);
    text-decoration: none;
    padding: 10px 20px;
    border-radius: 4px;
    transition: all 0.3s ease;
    font-weight: 300;
    font-size: 0.95rem;
    letter-spacing: 0.03rem;
}

.navbar-menu a:hover {
    color: var(--primary);
    background: var(--bg-hover);
}

.navbar-menu a.active {
    color: var(--primary);
    background: rgba(139, 125, 107, 0.08);
}

.navbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #8b7d6b, #a89988);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 400;
    font-size: 0.9rem;
    color: white;
}

.user-dropdown {
    position: relative;
}

.user-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-dark);
    font-family: 'Noto Sans KR', sans-serif;
    font-weight: 300;
}

.user-dropdown-toggle:hover {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-width: 180px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    display: none;
    z-index: 1001;
    margin-top: 4px;
}

.user-dropdown:hover .user-dropdown-menu {
    display: block;
}

.user-dropdown-menu a,
.user-dropdown-menu button {
    display: block;
    width: 100%;
    padding: 12px 18px;
    text-align: left;
    color: var(--text-dark);
    text-decoration: none;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    font-weight: 300;
    font-family: 'Noto Serif', serif;
}

.user-dropdown-menu a:hover,
.user-dropdown-menu button:hover {
    background: var(--bg-hover);
}

.user-dropdown-menu hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 6px 0;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px;
}

/* Headings */
h1, h2, h3, h4, h5, h6 {
    font-weight: 400;
    color: var(--text-dark);
    margin-bottom: 1rem;
    line-height: 1.3;
}

h1 {
    font-size: 3rem;
    font-weight: 300;
}

h2 {
    font-size: 2.4rem;
    font-weight: 300;
}

h3 {
    font-size: 1.8rem;
}

h4 {
    font-size: 1.4rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 400;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    font-family: 'Noto Sans KR', sans-serif;
    letter-spacing: 0.05rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 125, 107, 0.2);
}

.btn-secondary {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    transform: translateY(-1px);
}

.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-success:hover {
    background: #6a8b6e;
    border-color: #6a8b6e);
}

.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #a86863;
    border-color: #a86863;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.card h3 {
    margin-bottom: 16px;
    color: var(--text-dark);
}

/* Forms */
input, textarea, select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    font-family: 'Noto Serif', serif;
    color: var(--text-dark);
    background: var(--bg-card);
    transition: all 0.3s ease;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 125, 107, 0.1);
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 400;
    color: var(--text-medium);
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 20px;
}

/* Alerts */
.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid;
    background: var(--bg-card);
}

.alert-success {
    border-color: var(--success);
    background: rgba(122, 155, 126, 0.08);
    color: var(--success);
}

.alert-error {
    border-color: var(--danger);
    background: rgba(184, 120, 115, 0.08);
    color: var(--danger);
}

.alert-info {
    border-color: var(--info);
    background: rgba(141, 154, 173, 0.08);
    color: var(--info);
}

.alert-warning {
    border-color: var(--warning);
    background: rgba(196, 165, 116, 0.08);
    color: var(--warning);
}

/* Lists */
ul, ol {
    padding-left: 24px;
}

li {
    margin-bottom: 8px;
}

/* Links */
a {
    color: var(--primary);
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-dark);
}

/* Utilities */
.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

/* Loading Spinner */
.spinner {
    border: 3px solid var(--bg-gray);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .navbar-container {
        padding: 0 20px;
        height: 60px;
    }

    .navbar-brand span {
        display: none;
    }

    .navbar-menu {
        display: none;
    }

    .container {
        padding: 24px 16px;
    }

    h1 {
        font-size: 2.2rem;
    }

    h2 {
        font-size: 1.8rem;
    }

    .card {
        padding: 24px 20px;
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-gray);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Chat in Sidebar Styles */
.chat-actions-inline {
    display: flex;
    gap: 6px;
    float: right;
    margin-top: -5px;
}

.btn-icon-small {
    width: 28px;
    height: 28px;
    border-radius: 5px;
    border: 1px solid var(--border);
    background: transparent;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-medium);
    font-size: 0.85rem;
}

.btn-icon-small:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    color: var(--primary);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-messages-sidebar {
    max-height: 280px;
    min-height: 60px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    margin-bottom: 12px;
    padding: 0;
    background: transparent;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 90%;
}

.message.user {
    align-self: flex-end;
}

.message.assistant {
    align-self: flex-start;
}

.message-bubble {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.82rem;
    line-height: 1.4;
    font-weight: 300;
}

.message.user .message-bubble {
    background: #8b7d6b;
    color: white;
    border-bottom-right-radius: 4px;
}

.message.assistant .message-bubble {
    background: var(--bg-gray);
    color: var(--text-dark);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.message-timestamp {
    font-size: 0.75rem;
    color: #a89988;
    margin-top: 4px;
    padding: 0 4px;
    font-weight: 300;
}

.message-action {
    background: rgba(139, 125, 107, 0.08);
    border-left: 3px solid #8b7d6b;
    padding: 8px 12px;
    margin-top: 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #6b6b6b;
    font-family: 'Courier New', monospace;
}

.chat-input-container {
    border-top: 1px solid var(--border);
    padding: 20px;
    background: var(--bg-light);
}

.chat-input-container-sidebar {
    margin-top: 10px;
    padding: 0;
}

.chat-status {
    min-height: 16px;
    margin-bottom: 6px;
    font-size: 0.75rem;
    color: #999;
}

.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #8b7d6b;
}

.typing-indicator .dot {
    width: 6px;
    height: 6px;
    background: #8b7d6b;
    border-radius: 50%;
    animation: typing-pulse 1.4s infinite;
}

.typing-indicator .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing-pulse {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    30% {
        opacity: 1;
        transform: scale(1.2);
    }
}

.chat-input-wrapper {
    display: flex;
    gap: 8px;
}

#chat-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.85rem;
    resize: none;
    max-height: 80px;
    transition: all 0.3s ease;
    background: var(--bg-card);
}

#chat-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(139, 125, 107, 0.1);
}

.btn-send {
    padding: 8px 16px;
    background: #8b7d6b;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 0.85rem;
    font-weight: 400;
    transition: all 0.3s ease;
}

.btn-send:hover:not(:disabled) {
    background: #6b5d4b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(139, 125, 107, 0.3);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.message-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-top: 8px;
}
