:root {
    --primary-color: #4a90e2;
    --secondary-color: #50c878;
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --text-color: #333;
    --border-radius: 12px;
}

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 20px;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

h1 {
    margin: 0;
    color: var(--primary-color);
    font-size: 28px;
}

.header-btns {
    display: flex;
    gap: 10px;
}

.main-add-btn, .secondary-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.main-add-btn {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 10px rgba(74, 144, 226, 0.3);
}

.secondary-btn {
    background-color: var(--secondary-color);
    color: white;
    box-shadow: 0 4px 10px rgba(80, 200, 120, 0.3);
}

.main-add-btn:hover, .secondary-btn:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

/* Group Navigation */
.group-nav {
    margin-bottom: 30px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.group-tabs {
    display: flex;
    gap: 10px;
}

.group-tab {
    padding: 8px 18px;
    background-color: #fff;
    border: 1px solid #eee;
    border-radius: 20px;
    font-size: 14px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.group-tab.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.group-tab:hover:not(.active) {
    background-color: #f0f0f0;
}

/* Modal Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    max-height: 90vh;
    overflow-y: auto;
}

.small-modal {
    max-width: 350px;
}

.hidden {
    display: none;
}

.modal-content h2 {
    margin: 0 0 20px 0;
    text-align: center;
    color: var(--primary-color);
}

/* Photo Upload Section */
.photo-upload-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 25px;
}

.photo-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background-color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    margin-bottom: 12px;
    border: 3px solid #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-preview span {
    font-size: 40px;
}

.photo-label {
    padding: 6px 14px;
    background-color: #f0f0f0;
    border-radius: 20px;
    font-size: 12px;
    color: #555;
    cursor: pointer;
}

/* Form Styling */
.input-group {
    display: grid;
    gap: 12px;
    margin-bottom: 15px;
}

input, textarea, select {
    padding: 12px;
    border: 1px solid #eee;
    border-radius: 8px;
    font-size: 14px;
    width: 100%;
    box-sizing: border-box;
    background-color: #fafafa;
}

select {
    cursor: pointer;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: #fff;
}

textarea {
    height: 80px;
    resize: none;
    margin-bottom: 20px;
}

.button-group {
    display: flex;
    gap: 10px;
}

.save-btn {
    flex: 2;
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.cancel-btn {
    flex: 1;
    background-color: #f5f5f5;
    color: #777;
    border: none;
    padding: 14px;
    border-radius: 8px;
    cursor: pointer;
}

/* Grid & Cards */
.search-wrapper {
    margin-bottom: 25px;
}

#search-input {
    border-radius: 25px;
    padding: 12px 20px;
}

.people-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.person-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    position: relative;
    transition: transform 0.2s;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.person-card:hover {
    transform: translateY(-5px);
}

.card-img-wrapper {
    width: 100%;
    height: 200px;
    background-color: #f8f9fa;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-content {
    padding: 20px;
}

.person-card h3 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 18px;
}

.card-group-tag {
    display: inline-block;
    padding: 2px 8px;
    background-color: #eef2ff;
    color: var(--primary-color);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 8px;
}

.person-card p {
    margin: 6px 0;
    font-size: 13px;
    color: #888;
}

.person-card .memo-text {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f8f8f8;
    color: #555;
    font-size: 13px;
    line-height: 1.6;
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 10px;
}

.tag {
    font-size: 11px;
    background-color: #f1f5f9;
    color: #475569;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
}

.card-btns {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 5px;
    z-index: 10;
}

.delete-btn, .edit-btn {
    width: 26px;
    height: 26px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 16px;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* Detail & Timeline Modal */
.detail-modal {
    max-width: 600px;
    padding: 40px;
    position: relative;
}

.detail-header {
    display: flex;
    gap: 25px;
    margin-bottom: 30px;
    padding-bottom: 25px;
    border-bottom: 2px solid #f0f0f0;
}

.detail-img {
    width: 120px;
    height: 120px;
    border-radius: 15px;
    object-fit: cover;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.detail-text h2 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 26px;
}

.detail-text p {
    margin: 5px 0;
    color: #777;
    font-size: 14px;
}

.timeline-section {
    margin-top: 20px;
}

.timeline-section h3 {
    font-size: 18px;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.timeline-list {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding-right: 10px;
}

.timeline-item {
    padding: 15px;
    background-color: #f8faff;
    border-left: 3px solid var(--primary-color);
    border-radius: 0 8px 8px 0;
    margin-bottom: 12px;
    position: relative;
}

.timeline-delete-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: #cbd5e1;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    padding: 0 5px;
}

.timeline-delete-btn:hover {
    color: #ff4757;
}

.timeline-date {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.timeline-text {
    font-size: 14px;
    color: #334155;
    line-height: 1.5;
}

.timeline-input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.timeline-inputs {
    display: flex;
    gap: 10px;
}

.timeline-inputs input#timeline-title {
    flex: 1;
}

.timeline-inputs input#timeline-content {
    flex: 2;
}

.timeline-input-group input {
    border-radius: 20px;
    padding: 10px 20px;
    background-color: #f1f5f9;
}

.add-timeline-btn {
    width: 100%;
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 20px;
    font-weight: 600;
    cursor: pointer;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 30px;
    color: #cbd5e1;
    cursor: pointer;
    line-height: 1;
}

.close-btn:hover {
    color: #64748b;
}

.card-content {
    cursor: pointer;
}

.card-img-wrapper {
    cursor: pointer;
}
