/* Data & Note Manager - 통합 스타일 */

/* ==================== Base & Reset ==================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--sp6, 32px) var(--sp4, 16px);
}

/* ==================== Header ==================== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--sp6, 32px);
    padding-bottom: var(--sp4, 16px);
    border-bottom: 2px solid var(--g200, #e5e7eb);
}

.title {
    font-size: var(--fs-h1, 2.2rem);
    font-weight: 700;
    color: var(--g900, #18181b);
    display: flex;
    align-items: center;
    gap: var(--sp3, 12px);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: var(--sp3, 12px);
}

/* ==================== Tab Navigation ==================== */
.tabs-nav {
    display: flex;
    gap: var(--sp2, 8px);
    margin-bottom: var(--sp5, 24px);
    border-bottom: 2px solid var(--g200, #e5e7eb);
    overflow-x: auto;
    scrollbar-width: thin;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: var(--sp2, 8px);
    padding: var(--sp3, 12px) var(--sp4, 16px);
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--g500, #6b7280);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--brand, #6366f1);
    background: var(--g100, #f3f4f6);
}

.tab-btn.active {
    color: var(--brand, #6366f1);
    border-bottom-color: var(--brand, #6366f1);
}

.tab-btn .material-icons {
    font-size: 1.3rem;
}

/* ==================== Tab Content ==================== */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== Cards ==================== */
.card {
    background: var(--glass-bg, rgba(255,255,255,0.7));
    backdrop-filter: blur(var(--blur, 20px));
    border-radius: var(--radius-card, 1.2rem);
    padding: var(--sp5, 24px);
    margin-bottom: var(--sp5, 24px);
    box-shadow: var(--shadow, 0 4px 32px rgba(0,0,0,0.06));
    transition: box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-hover, 0 8px 40px rgba(0,0,0,0.12));
}

.card h2 {
    font-size: var(--fs-h2, 1.8rem);
    font-weight: 700;
    color: var(--g900, #18181b);
    margin-bottom: var(--sp4, 16px);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--sp4, 16px);
}

/* ==================== Forms ==================== */
.input-group {
    display: flex;
    flex-direction: column;
    gap: var(--sp3, 12px);
}

.input,
.textarea {
    width: 100%;
    padding: var(--sp3, 12px) var(--sp4, 16px);
    border: 2px solid var(--g200, #e5e7eb);
    border-radius: var(--radius-btn, 8px);
    font-family: Pretendard, system-ui, sans-serif;
    font-size: 1rem;
    color: var(--g900, #18181b);
    background: var(--g50, white);
    transition: all 0.2s ease;
}

.input:focus,
.textarea:focus {
    outline: none;
    border-color: var(--brand, #6366f1);
    box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

.textarea {
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

.input-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ==================== Buttons ==================== */
.btn {
    padding: var(--sp3, 12px) var(--sp5, 24px);
    border: none;
    border-radius: var(--radius-btn, 8px);
    font-family: Pretendard, system-ui, sans-serif;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: var(--sp2, 8px);
}

.btn-primary {
    background: var(--brand, #6366f1);
    color: white;
}

.btn-primary:hover {
    background: var(--brand-hov, #4f46e5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99,102,241,0.3);
}

.btn-secondary {
    background: var(--g100, #f3f4f6);
    color: var(--g900, #18181b);
    border: 2px solid var(--g200, #e5e7eb);
}

.btn-secondary:hover {
    background: var(--g200, #e5e7eb);
}

.btn-outline {
    background: transparent;
    color: var(--g700, #374151);
    border: 2px solid var(--g300, #d4d4d8);
}

.btn-outline:hover {
    background: var(--g100, #f3f4f6);
    border-color: var(--g500, #6b7280);
}

.btn-sm {
    padding: var(--sp2, 8px) var(--sp3, 12px);
    font-size: 0.9rem;
}

/* ==================== Tags ==================== */
.tags-input-container {
    display: flex;
    flex-direction: column;
    gap: var(--sp2, 8px);
}

.tags-display {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp2, 8px);
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: var(--sp2, 8px);
    padding: var(--sp2, 8px) var(--sp3, 12px);
    background: var(--brand-light, #eef2ff);
    color: var(--brand, #6366f1);
    border-radius: var(--radius-btn, 8px);
    font-size: 0.9rem;
    font-weight: 500;
}

.tag-remove {
    background: none;
    border: none;
    color: var(--brand, #6366f1);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0;
    opacity: 0.7;
}

.tag-remove:hover {
    opacity: 1;
}

/* ==================== Notes Grid ==================== */
.notes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--sp4, 16px);
}

.note-card {
    background: var(--g50, white);
    border: 2px solid var(--g200, #e5e7eb);
    border-radius: var(--radius-btn, 8px);
    padding: var(--sp4, 16px);
    cursor: pointer;
    transition: all 0.2s ease;
}

.note-card:hover {
    border-color: var(--brand, #6366f1);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(99,102,241,0.15);
}

.note-card h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--g900, #18181b);
    margin-bottom: var(--sp2, 8px);
}

.note-card-content {
    color: var(--g700, #374151);
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: var(--sp3, 12px);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.note-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--g500, #6b7280);
}

.note-card-actions {
    display: flex;
    gap: var(--sp2, 8px);
}

.note-card-actions button {
    padding: var(--sp2, 8px);
    background: none;
    border: none;
    color: var(--g500, #6b7280);
    cursor: pointer;
    font-size: 1rem;
    transition: color 0.2s ease;
}

.note-card-actions button:hover {
    color: var(--brand, #6366f1);
}

/* ==================== Task Items ==================== */
.task-items-preview,
.task-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp2, 8px);
}

.task-item {
    display: flex;
    align-items: center;
    gap: var(--sp3, 12px);
    padding: var(--sp3, 12px);
    background: var(--g100, #f3f4f6);
    border-radius: var(--radius-btn, 8px);
    transition: all 0.2s ease;
}

.task-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.task-item.completed {
    opacity: 0.6;
}

.task-item.completed .task-text {
    text-decoration: line-through;
}

.task-text {
    flex: 1;
    color: var(--g900, #18181b);
    font-size: 0.95rem;
}

.task-remove {
    background: none;
    border: none;
    color: var(--g500, #6b7280);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    opacity: 0;
    transition: all 0.2s ease;
}

.task-item:hover .task-remove {
    opacity: 1;
}

.task-remove:hover {
    color: #ef4444;
}

/* ==================== Tasks Grid ==================== */
.tasks-grid {
    display: grid;
    gap: var(--sp4, 16px);
}

.task-card {
    background: var(--g50, white);
    border: 2px solid var(--g200, #e5e7eb);
    border-radius: var(--radius-btn, 8px);
    padding: var(--sp4, 16px);
}

.task-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--sp3, 12px);
}

.task-card-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--g900, #18181b);
}

.task-progress {
    text-align: center;
    margin-bottom: var(--sp3, 12px);
}

.task-progress-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--brand, #6366f1);
}

.task-progress-label {
    font-size: 0.85rem;
    color: var(--g500, #6b7280);
}

/* ==================== Stats Grid ==================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--sp4, 16px);
    margin-bottom: var(--sp5, 24px);
}

.stat-card {
    background: var(--g50, white);
    border: 2px solid var(--g200, #e5e7eb);
    border-radius: var(--radius-btn, 8px);
    padding: var(--sp4, 16px);
    display: flex;
    align-items: center;
    gap: var(--sp3, 12px);
}

.stat-card.income {
    border-color: #22c55e;
    background: linear-gradient(135deg, #f0fdf4 0%, white 100%);
}

.stat-card.expense {
    border-color: #ef4444;
    background: linear-gradient(135deg, #fef2f2 0%, white 100%);
}

.stat-card.balance {
    border-color: var(--brand, #6366f1);
    background: linear-gradient(135deg, #eef2ff 0%, white 100%);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-light, #eef2ff);
    color: var(--brand, #6366f1);
}

.stat-card.income .stat-icon {
    background: #dcfce7;
    color: #22c55e;
}

.stat-card.expense .stat-icon {
    background: #fee2e2;
    color: #ef4444;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 0.9rem;
    color: var(--g500, #6b7280);
    margin-bottom: var(--sp1, 4px);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--g900, #18181b);
}

/* ==================== Transaction Type Selector ==================== */
.transaction-type-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp2, 8px);
    margin-bottom: var(--sp3, 12px);
}

.type-btn {
    padding: var(--sp3, 12px);
    background: var(--g100, #f3f4f6);
    border: 2px solid var(--g200, #e5e7eb);
    border-radius: var(--radius-btn, 8px);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp2, 8px);
}

.type-btn:hover {
    background: var(--g200, #e5e7eb);
}

.type-btn.active.income {
    background: #22c55e;
    color: white;
    border-color: #22c55e;
}

.type-btn.active.expense {
    background: #ef4444;
    color: white;
    border-color: #ef4444;
}

/* ==================== Transactions List ==================== */
.transactions-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp2, 8px);
}

.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--sp3, 12px);
    background: var(--g50, white);
    border: 2px solid var(--g200, #e5e7eb);
    border-radius: var(--radius-btn, 8px);
}

.transaction-info {
    flex: 1;
}

.transaction-desc {
    font-weight: 600;
    color: var(--g900, #18181b);
    margin-bottom: var(--sp1, 4px);
}

.transaction-meta {
    font-size: 0.85rem;
    color: var(--g500, #6b7280);
}

.transaction-amount {
    font-size: 1.2rem;
    font-weight: 700;
    margin-right: var(--sp3, 12px);
}

.transaction-amount.income {
    color: #22c55e;
}

.transaction-amount.expense {
    color: #ef4444;
}

/* ==================== Settings ==================== */
.settings-grid {
    display: grid;
    gap: var(--sp3, 12px);
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--sp4, 16px);
    background: var(--g50, white);
    border: 2px solid var(--g200, #e5e7eb);
    border-radius: var(--radius-btn, 8px);
}

.setting-info h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--g900, #18181b);
    margin-bottom: var(--sp1, 4px);
}

.setting-info p {
    font-size: 0.9rem;
    color: var(--g500, #6b7280);
}

.storage-info {
    display: flex;
    flex-direction: column;
    gap: var(--sp3, 12px);
}

.storage-item {
    display: flex;
    justify-content: space-between;
    padding: var(--sp3, 12px);
    background: var(--g100, #f3f4f6);
    border-radius: var(--radius-btn, 8px);
}

/* ==================== Empty State ==================== */
.empty-state {
    text-align: center;
    padding: var(--sp8, 48px) var(--sp4, 16px);
    color: var(--g500, #6b7280);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: var(--sp4, 16px);
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.3rem;
    color: var(--g700, #374151);
    margin-bottom: var(--sp2, 8px);
}

.empty-state p {
    font-size: 1rem;
    color: var(--g500, #6b7280);
}

/* ==================== Search ==================== */
.search-box {
    min-width: 250px;
}

.search-box .input {
    padding: var(--sp2, 8px) var(--sp3, 12px);
    font-size: 0.9rem;
}

/* ==================== Toggle Switch ==================== */
.toggle {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-track {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--g300, #d4d4d8);
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-thumb {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle input:checked + .toggle-track {
    background-color: var(--brand, #6366f1);
}

.toggle input:checked + .toggle-track .toggle-thumb {
    transform: translateX(24px);
}

/* ==================== Responsive Design ==================== */
@media (max-width: 768px) {
    main {
        padding: var(--sp4, 16px);
    }

    .header {
        flex-direction: column;
        gap: var(--sp3, 12px);
        align-items: flex-start;
    }

    .title {
        font-size: 1.8rem;
    }

    .tabs-nav {
        overflow-x: scroll;
        scrollbar-width: none;
    }

    .tabs-nav::-webkit-scrollbar {
        display: none;
    }

    .notes-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .setting-item {
        flex-direction: column;
        gap: var(--sp3, 12px);
        align-items: flex-start;
    }
}

/* ==================== Dark Theme Support ==================== */
[data-theme="dark"] .card {
    background: var(--glass-bg-dark, rgba(24,24,27,0.6));
}

[data-theme="dark"] .note-card,
[data-theme="dark"] .task-card,
[data-theme="dark"] .stat-card,
[data-theme="dark"] .transaction-item,
[data-theme="dark"] .setting-item {
    background: var(--g100, #27272a);
    border-color: var(--g200, #3f3f46);
}

[data-theme="dark"] .task-item,
[data-theme="dark"] .storage-item {
    background: var(--g200, #3f3f46);
}
