/* 
 * AI Empathy Diary - Design System
 * Designed by Frontend Developer & UX Designer
 * Theme: Warm, Cozy, Paper-like
 */

@import url('https://fonts.googleapis.com/css2?family=Gaegu:wght@300;400;700&family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

:root {
    --bg-color: #FDFBF7;
    /* 따뜻한 종이 색 */
    --paper-color: #FFFFFF;
    --primary-color: #8D6E63;
    /* 부드러운 갈색 */
    --accent-color: #FFB7B2;
    /* 살구색 */
    --text-color: #4E4E4E;
    --sub-text-color: #8C8C8C;
    --shadow: 0 4px 20px rgba(141, 110, 99, 0.1);
    --border-radius: 16px;
}

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

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 20px;
}

.app-container {
    width: 100%;
    max-width: 600px;
    background: transparent;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    padding-top: 20px;
}

h1 {
    font-family: 'Gaegu', cursive;
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.subtitle {
    font-size: 0.95rem;
    color: var(--sub-text-color);
}

/* API Key Bar */
.api-bar {
    background: white;
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    font-size: 0.9rem;
}

.api-status {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ccc;
}

.status-dot.active {
    background-color: #4CAF50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.4);
}

.btn-small {
    background: var(--bg-color);
    border: 1px solid #ddd;
    padding: 6px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-color);
    transition: all 0.2s;
}

.btn-small:hover {
    background: #eee;
}

/* Write Section */
.write-section {
    background: var(--paper-color);
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    position: relative;
    border: 1px solid #FAF5EF;
}

.write-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 24px;
    width: 2px;
    height: 100%;
    background: repeating-linear-gradient(to bottom,
            transparent 0,
            transparent 3px,
            #f0f0f0 3px,
            #f0f0f0 6px);
}

textarea {
    width: 100%;
    min-height: 120px;
    border: 2px solid #EFEFEF;
    border-radius: 12px;
    padding: 16px;
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 1rem;
    resize: none;
    outline: none;
    transition: border-color 0.3s;
    background: #FCFCFC;
    margin-bottom: 16px;
}

textarea:focus {
    border-color: var(--accent-color);
    background: white;
}

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

.btn-primary:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(141, 110, 99, 0.3);
}

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Diary List */
.diary-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.diary-card {
    background: var(--paper-color);
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    animation: slideIn 0.5s ease;
    border-left: 6px solid transparent;
    /* 감정 색상 들어갈 곳 */
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.diary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 0.85rem;
    color: var(--sub-text-color);
}

.emotion-tag {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: white;
}

.diary-content {
    font-size: 1rem;
    color: var(--text-color);
    margin-bottom: 20px;
    line-height: 1.7;
    white-space: pre-wrap;
}

.ai-response {
    background: #FAF8F5;
    padding: 16px;
    border-radius: 12px;
    border-top: 2px solid rgba(0, 0, 0, 0.05);
}

.ai-response h4 {
    font-family: 'Gaegu', cursive;
    color: var(--primary-color);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.empathy-text {
    font-size: 0.95rem;
    color: #555;
    margin-bottom: 12px;
    font-style: italic;
}

.advice-text {
    font-size: 0.9rem;
    color: #666;
    background: white;
    padding: 10px;
    border-radius: 8px;
    border: 1px dashed #ddd;
}

.delete-btn {
    background: none;
    border: none;
    color: #ccc;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px;
}

.delete-btn:hover {
    color: #ff6b6b;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
}

.modal h2 {
    font-family: 'Gaegu', cursive;
    color: var(--primary-color);
    margin-bottom: 16px;
}

.input-field {
    width: 100%;
    padding: 12px;
    margin: 16px 0;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
}

/* Spinner */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.empty-state {
    text-align: center;
    color: #ccc;
    padding: 40px;
    font-family: 'Gaegu', cursive;
    font-size: 1.2rem;
}