@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@400;500;700;800&display=swap');

:root {
    --bg-color: #121212;
    --card-bg: #1e1e1e;
    --text-main: #ffffff;
    --text-sub: rgba(255, 255, 255, 0.6);
    --primary-green: #29cc84;
    --danger: #ff5252;
    --input-bg: rgba(0, 0, 0, 0.2);
    --border-color: rgba(255, 255, 255, 0.05);

    --sb-width: 100px;
    --bb-height: 64px;
}

[data-theme="light"] {
    --bg-color: #f6f7fa;
    --card-bg: #ffffff;
    --text-main: #1a1a1a;
    --text-sub: #7b8190;
    --input-bg: rgba(0, 0, 0, 0.05);
    --border-color: rgba(0, 0, 0, 0.05);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Noto Sans KR', sans-serif;
    transition: background 0.3s ease, color 0.3s ease;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    overflow: hidden;
}

/* App Layout Setup */
.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
}

.sidebar {
    width: var(--sb-width);
    background-color: var(--card-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidebar-logo {
    font-weight: 900;
    font-size: 16px;
    margin-bottom: 40px;
    letter-spacing: -0.5px;
}

.sidebar-menu {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
}

.menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: var(--text-sub);
    padding: 12px 0;
    position: relative;
}

.menu-item.active {
    color: var(--primary-green);
    font-weight: bold;
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: 10px;
    right: 10px;
    top: 4px;
    bottom: 4px;
    background-color: rgba(41, 204, 132, 0.2);
    border-radius: 12px;
    z-index: 0;
}

.menu-item>* {
    z-index: 1;
}

.bottom-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--bb-height);
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    z-index: 100;
}

.bottom-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--text-sub);
    font-size: 12px;
    cursor: pointer;
}

.bottom-item.active {
    color: var(--primary-green);
    font-weight: bold;
}

.main-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    flex-direction: column;
}

.screen.active {
    display: flex;
}

.app-header {
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-color);
    flex-shrink: 0;
}

.app-header h2 {
    font-size: 20px;
    font-weight: bold;
}

.header-actions {
    display: flex;
    gap: 16px;
    align-items: center;
}

.scroll-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.icon-btn {
    cursor: pointer;
    color: var(--text-sub);
    width: 24px;
    height: 24px;
}

.icon-btn:hover {
    color: var(--text-main);
}

.theme-toggle {
    width: 44px;
    height: 44px;
    border-radius: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--input-bg);
    cursor: pointer;
}

[data-theme="dark"] .icon-dark {
    display: none;
}

[data-theme="light"] .icon-light {
    display: none;
}

.mobile-only {
    display: none;
}

/* Login */
.login-content {
    margin: auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: var(--card-bg);
    padding: 40px;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.primary-btn {
    background: var(--primary-green);
    color: black;
    border: none;
    border-radius: 12px;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.full-width {
    width: 100%;
}

.outline-btn {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
}

.dashed-btn {
    background: transparent;
    color: var(--primary-green);
    border: 1px dashed var(--primary-green);
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
    font-weight: bold;
    display: flex;
    justify-content: center;
    gap: 8px;
}

/* Cards */
.card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border: 1px solid transparent;
}

.card:hover {
    border-color: var(--border-color);
}

.d-day-badge {
    background: var(--primary-green);
    color: black;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: bold;
}

.d-day-badge.urgent {
    background: var(--danger);
    color: white;
}

/* Split View for Project Detail */
.split-layout-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    padding: 24px;
}

.split-separator {
    display: none;
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 16px;
    background: var(--primary-green);
    color: black;
    font-weight: bold;
    font-size: 13px;
    margin-bottom: 16px;
}

.title-input.transparent-input {
    background: transparent;
    border: none;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-main);
    margin-bottom: 24px;
    width: 100%;
    outline: none;
}

.info-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.info-group label {
    font-size: 13px;
    color: var(--text-sub);
}

.info-input,
.info-textarea {
    background: var(--input-bg);
    border: none;
    border-radius: 12px;
    padding: 16px;
    color: var(--text-main);
    font-size: 15px;
    outline: none;
    width: 100%;
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.quotation-box {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px;
}

.quote-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 12px;
}

/* Layout Breakpoints */
@media (min-width: 800px) {
    .split-layout-container {
        flex-direction: row;
    }

    .split-left {
        flex: 4;
    }

    .split-right {
        flex: 6;
    }

    .split-separator {
        display: block;
        width: 1px;
        background: var(--border-color);
        margin: 0 12px;
    }
}

/* Calendar */
.calendar-container {
    background: var(--card-bg);
    padding: 16px;
    border-radius: 16px;
    text-align: center;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.cal-day-header {
    font-size: 12px;
    color: var(--text-sub);
    padding-bottom: 8px;
}

.cal-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 40px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
}

.cal-cell:hover {
    background: var(--input-bg);
}

.cal-cell.today {
    background: rgba(41, 204, 132, 0.2);
    color: var(--primary-green);
    font-weight: bold;
}

.cal-cell.dot::after {
    content: '';
    width: 4px;
    height: 4px;
    background: var(--danger);
    border-radius: 2px;
    margin-top: 2px;
}

/* Ledger Stats */
.ledger-stats {
    display: flex;
    gap: 16px;
}

.stat-box {
    flex: 1;
    background: var(--card-bg);
    padding: 16px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 13px;
    color: var(--text-sub);
    margin-bottom: 4px;
}

.stat-val {
    font-size: 20px;
    font-weight: bold;
}

.stat-val.income {
    color: var(--primary-green);
}

.stat-val.expense {
    color: var(--danger);
}

/* Chart (Income) */
.chart-box {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 200px;
    padding: 24px;
    background: var(--card-bg);
    border-radius: 16px;
}

.bar-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    width: 100%;
}

.bar {
    width: 24px;
    background: var(--primary-green);
    border-radius: 4px 4px 0 0;
    min-height: 4px;
}

.bar-label {
    font-size: 11px;
    color: var(--text-sub);
    margin-top: 8px;
}

/* Experts */
.expert-filters {
    display: flex;
    gap: 8px;
    padding: 16px 24px;
    overflow-x: auto;
    background: var(--bg-color);
    flex-shrink: 0;
}

.expert-chip {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    background: var(--card-bg);
    color: var(--text-main);
    cursor: pointer;
    white-space: nowrap;
}

.expert-chip.active {
    background: var(--primary-green);
    color: black;
    font-weight: bold;
}

.expert-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 16px;
    display: flex;
    gap: 16px;
    align-items: center;
}

.expert-avatar {
    width: 60px;
    height: 60px;
    border-radius: 30px;
    background: var(--input-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.expert-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.expert-tag {
    font-size: 11px;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: var(--text-sub);
    display: inline-block;
}

[data-theme="light"] .expert-tag {
    background: black;
    color: white;
}

/* bottom Sheet Modal */
.bottom-sheet-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.bottom-sheet-overlay.active {
    display: flex;
}

.bottom-sheet-content {
    background: var(--card-bg);
    width: 100%;
    max-width: 600px;
    border-radius: 24px 24px 0 0;
    padding: 24px;
    animation: slideUp 0.3s ease;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.bottom-sheet-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    flex-shrink: 0;
}

.bottom-sheet-body {
    overflow-y: auto;
    flex: 1;
    padding-bottom: 24px;
}

.input-field {
    width: 100%;
    padding: 16px;
    background: var(--input-bg);
    color: var(--text-main);
    border: none;
    border-radius: 12px;
    font-size: 15px;
    outline: none;
}

.tx-type-btn {
    flex: 1;
    padding: 12px;
    background: var(--input-bg);
    color: var(--text-main);
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
}

.tx-type-btn.active {
    background: var(--primary-green);
    color: black;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

/* AI Chat */
.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    max-width: 80%;
    line-height: 1.5;
    font-size: 14px;
}

.chat-bubble.ai {
    align-self: flex-start;
    background: var(--card-bg);
    color: var(--text-main);
}

.chat-bubble.user {
    align-self: flex-end;
    background: var(--primary-green);
    color: black;
}

.chat-suggestions {
    display: flex;
    gap: 8px;
    padding: 0 24px 12px;
    overflow-x: auto;
    flex-shrink: 0;
}

.suggestion-chip {
    background: var(--input-bg);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 16px;
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid var(--border-color);
}

.chat-input-area {
    padding: 16px 24px;
    background: var(--card-bg);
    display: flex;
    gap: 8px;
    align-items: center;
    border-top: 1px solid var(--border-color);
    flex-shrink: 0;
}

.chat-input-area input {
    flex: 1;
    padding: 14px 20px;
    border-radius: 24px;
    background: var(--input-bg);
    color: var(--text-main);
    border: none;
    outline: none;
    font-size: 14px;
}

.mic-btn,
.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 22px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mic-btn {
    background: var(--input-bg);
    color: var(--text-main);
}

.mic-btn.recording {
    background: var(--danger);
    color: white;
    animation: pulse 1s infinite alternate;
}

.send-btn {
    background: var(--primary-green);
    color: black;
}

@keyframes pulse {
    from {
        opacity: 1;
        transform: scale(1);
    }

    to {
        opacity: 0.8;
        transform: scale(1.1);
    }
}

.fab-btn {
    position: absolute;
    bottom: 24px;
    right: 24px;
    background: var(--primary-green);
    color: black;
    border: none;
    border-radius: 28px;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(41, 204, 132, 0.4);
    z-index: 50;
}

@media (max-width: 800px) {
    .sidebar {
        display: none;
    }

    .bottom-bar {
        display: flex;
    }

    .mobile-only {
        display: flex;
    }

    .app-header .header-actions {
        margin-right: 0;
    }

    .main-content {
        padding-bottom: var(--bb-height);
        border-bottom: none;
    }

    .fab-btn {
        bottom: calc(var(--bb-height) + 24px);
    }

    .screen {
        padding-bottom: var(--bb-height);
    }

    /* Ensure scrolling leaves space for bottom bar */
}