:root {
    --background-color: #f0f0f0;
    --text-color: #333;
    --panel-bg: #ffffff;
    --item-bg: #f9f9f9;
    --item-hover-bg: #efefef;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --button-glow: rgba(79, 128, 255, 0.5);
    --border-color: #e0e0e0;
    --card-bg: #ffffff;
    --accent-color: #4f80ff;
}

[data-theme="dark"] {
    --background-color: #121212;
    --text-color: #e0e0e0;
    --panel-bg: #1e1e1e;
    --item-bg: #2a2a2a;
    --item-hover-bg: #333333;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --border-color: #333333;
    --card-bg: #1e1e1e;
}

[data-theme="neutral"] {
    --background-color: #f5f5f0;
    --text-color: #444444;
    --panel-bg: #ebebe0;
    --item-bg: #e0e0d1;
    --item-hover-bg: #d6d6c2;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --border-color: #d1d1c2;
    --card-bg: #ebebe0;
}

body {
    font-family: 'Noto Sans KR', sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    margin: 0;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex-grow: 1;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    overflow-y: auto;
}

.theme-switcher {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    display: flex;
    gap: 0.5rem;
    background-color: var(--panel-bg);
    padding: 0.5rem;
    border-radius: 30px;
    box-shadow: 0 2px 10px var(--shadow-color);
    border: 1px solid var(--border-color);
    z-index: 100;
}

.theme-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.theme-btn:hover {
    transform: scale(1.1);
}

.theme-btn.active {
    border-color: var(--accent-color);
}

.theme-btn[data-theme="light"] { background-color: #ffffff; border-color: #ddd; }
.theme-btn[data-theme="dark"] { background-color: #333333; border-color: #555; }
.theme-btn[data-theme="neutral"] { background-color: #f5f5f0; border-color: #d1d1c2; }

.history-panel {
    width: 300px;
    flex-shrink: 0;
    background-color: var(--panel-bg);
    padding: 1.5rem;
    border-left: 1px solid var(--border-color);
    box-shadow: -5px 0 15px var(--shadow-color);
    overflow-y: auto;
    transition: background-color 0.3s ease;
    display: flex;
    flex-direction: column;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

#palette-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    height: 160px;
    width: 100%;
    max-width: 600px;
}

.color-box {
    flex-grow: 1;
    border-radius: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 0.8rem;
    box-shadow: 0 4px 10px var(--shadow-color);
}

.color-box:hover {
    transform: scale(1.03);
}

.color-hex {
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.color-box:hover .color-hex {
    opacity: 1;
}

#relationship-container {
    background-color: var(--card-bg);
    padding: 1.2rem;
    border-radius: 8px;
    box-shadow: 0 4px 15px var(--shadow-color);
    max-width: 600px;
    width: 100%;
    margin-bottom: 1.5rem;
    text-align: center;
    line-height: 1.5;
    border: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
    box-sizing: border-box;
    font-size: 0.95rem;
}

#new-palette-btn {
    padding: 0.8rem 1.8rem;
    border: none;
    border-radius: 50px;
    background-color: var(--accent-color);
    color: white;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px var(--shadow-color);
    margin-bottom: 2rem;
}

#new-palette-btn:hover, #new-palette-btn:focus {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--button-glow);
    outline: none;
}

.history-panel h2 {
    font-size: 1.3rem;
    margin-bottom: 1.2rem;
}

#history-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.history-item {
    background-color: var(--item-bg);
    border-radius: 8px;
    padding: 0.8rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
    border: 1px solid var(--border-color);
}

.history-item:hover {
    background-color: var(--item-hover-bg);
}

/* Contact Section Styles */
.contact-section {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
    margin-top: auto;
}

.contact-section h3 {
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
}

#contact-form {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.form-group input, .form-group textarea {
    width: 100%;
    padding: 0.7rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--item-bg);
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.85rem;
    box-sizing: border-box;
}

.form-group textarea {
    height: 70px;
    resize: vertical;
}

.submit-btn {
    padding: 0.7rem;
    border: none;
    border-radius: 6px;
    background-color: var(--accent-color);
    color: white;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9rem;
}

/* Comments Section Styles */
.comments-section {
    width: 100%;
    max-width: 600px;
    margin-top: 1rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background-color: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow-color);
    margin-bottom: 2rem;
    box-sizing: border-box;
}

.comments-section h2 {
    font-size: 1.2rem;
    margin-bottom: 1.2rem;
    text-align: left;
    color: var(--text-color);
    font-weight: 700;
}

/* Comment Input Styles */
.comment-input-container {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    margin-bottom: 2rem;
    background-color: var(--item-bg);
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.comment-user-info input {
    width: 150px;
    padding: 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background-color: var(--panel-bg);
    color: var(--text-color);
    font-size: 0.85rem;
}

#comment-text {
    width: 100%;
    height: 80px;
    padding: 0.8rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background-color: var(--panel-bg);
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.9rem;
    resize: none;
    box-sizing: border-box;
}

.comment-submit-row {
    display: flex;
    justify-content: flex-end;
}

#submit-comment-btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 4px;
    background-color: var(--accent-color);
    color: white;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.85rem;
    transition: opacity 0.2s ease;
}

#submit-comment-btn:hover {
    opacity: 0.9;
}

/* Comment List Styles */
#comment-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.comment-item {
    display: flex;
    gap: 1rem;
    animation: fadeIn 0.3s ease;
}

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

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    background-color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.comment-content {
    flex-grow: 1;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 0.3rem;
}

.comment-nickname {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--accent-color);
}

.comment-date {
    font-size: 0.75rem;
    color: var(--text-color);
    opacity: 0.5;
}

.comment-body {
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-color);
}

/* Responsive Styles */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column-reverse;
    }
    .theme-switcher {
        top: 1rem;
        right: 1rem;
    }
    .history-panel {
        width: 100%;
        height: auto;
        border-left: none;
        border-top: 1px solid var(--border-color);
        box-shadow: 0 -5px 15px var(--shadow-color);
        padding: 1.5rem;
    }
    .main-content {
        padding: 3.5rem 1rem 1rem 1rem;
    }
    h1 {
        font-size: 1.8rem;
        margin-top: 1.5rem;
    }
    #palette-container {
        height: 130px;
    }
    .comments-section {
        margin-top: 2rem;
        padding: 1rem;
    }
    .contact-section {
        margin-top: 1.5rem;
        padding-bottom: 1.5rem;
    }
}
