/* 기본 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: beige;
    min-height: 100vh;
    max-height: 100vh;
}

#background-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    z-index: -1;
}

.main-content {
    position: relative;
    z-index: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    margin-top: 20px;
}

.left-section {
    position: relative;
    width: 100%;
    height: 400px;
    gap: 10px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    margin-bottom: 10px;
    box-sizing: border-box;
}

.right-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.top-widgets {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.welcome-message {
    text-align: center;
    padding: 40px 20px;
    background: rgba(66, 63, 68, 0.726);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    border: 1px solid rgba(66, 63, 68, 0.726);
}

.welcome-message h1 {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 3rem;
    color: #fff;
    margin-bottom: 10px;
}

.welcome-message p {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
}

#quote-text {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.4rem;
    color: #fff;
    margin: 15px 0 5px 0;
    font-style: italic;
}

#quote-meaning {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
}

/* --- 이미지 컨테이너 --- */
/* 이제 부모(.widget-content)의 높이가 명확하므로 100%를 사용할 수 있음 */
.current-image-container {
    width: 95%;
    height: 95%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 15px; /* 테두리는 컨테이너에 적용 */
    overflow: hidden; /* 이미지 모서리도 둥글게 처리하기 위함 */
}

/* --- 최종 이미지 스타일 --- */
/* 컨테이너 안에서 잘리지 않고 꽉 차도록 설정 */
.current-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain; /* 이미지 비율을 유지하며, 잘리지 않게 함 */
    border-radius: 10px; /* 이미지 자체에도 약간의 둥근 모서리 적용 */
    display: block;
}

.widget {
    background: rgba(66, 63, 68, 0.726);
    backdrop-filter: blur(15px);
    border-radius: 15px;
    border: 1px solid rgba(66, 63, 68, 0.726);
    overflow: hidden;
}

.image-widget {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-width: 100%;
    max-height: 100%;
    box-sizing: border-box;
    margin: 20px 20px;
}

.widget-header {
    background: rgba(255, 255, 255, 0.4);
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.widget-header h3 {
    color: #fff;
    font-size: 1.1rem;
    margin: 0;
}

.widget-content {
    padding: 20px;
}

.widget-image-content {
    flex: 1; /* 헤더를 제외한 모든 남은 세로 공간을 차지하도록 설정 */
    display: flex; /* 자식(.current-image-container)을 중앙 정렬하기 위해 flex 사용 */
    align-items: center;
    justify-content: center;
    padding: 20px; /* 위젯 콘텐츠 영역의 안쪽 여백 유지 */
    min-height: 0; /* Flexbox의 고질적인 넘침(overflow) 문제를 방지하는 안전장치 */
    box-sizing: border-box;
}

.clock-display {
    font-size: 2.5rem;
    color: #fff;
    text-align: center;
    margin-bottom: 10px;
    font-family: Georgia, 'Times New Roman', serif;
}

.date-display {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    text-align: center;
}

.weather-location {
    font-size: 1.1rem;
    color: #fff;
    margin-bottom: 10px;
}

.weather-temp {
    font-size: 2rem;
    color: #fff;
    margin-bottom: 5px;
}

.weather-desc {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
}

.todo-input-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#todo-input {
    flex: 1;
    padding: 12px 15px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.4);
    color: #fff;
}

#todo-input::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

#add-todo-btn {
    padding: 12px 20px;
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.todo-list {
    list-style: none;
    max-height: 300px;
    overflow-y: auto;
}

.todo-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
}

.todo-item.empty-message {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    font-style: italic;
    padding: 20px 0;
}

.todo-checkbox {
    margin-right: 12px;
    width: 18px;
    height: 18px;
}

.todo-text {
    flex: 1;
    font-size: 0.9rem;
}

.todo-text.completed {
    text-decoration: line-through;
    opacity: 0.6;
}

.delete-todo {
    background: rgba(255, 255, 255, 0.4);
    border: none;
    color: #fff;
    padding: 5px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.popup-content {
    background: rgba(66, 63, 68, 0.726);
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    transform: scale(0.8);
    transition: transform 0.3s ease;
}

.popup-overlay.active .popup-content {
    transform: scale(1);
}

.popup-header {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(15px);
    color: #fff;
    padding: 20px;
    border-radius: 20px 20px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.popup-header h2 {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.3rem;
    margin: 0;
    color: #fff;
}

.close-btn {
    background: rgba(66, 63, 68, 0.726);
    border: 1px solid rgba(66, 63, 68, 0.8);
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(66, 63, 68, 0.9);
    transform: scale(1.1);
}

.popup-body {
    padding: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #fff;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid rgba(66, 63, 68, 0.5);
    border-radius: 8px;
    font-size: 1rem;
    background: rgba(66, 63, 68, 0.3);
    color: #fff;
}

.form-group input:focus {
    outline: none;
    border-color: rgba(66, 63, 68, 0.8);
    background: rgba(66, 63, 68, 0.5);
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.7);
}

.login-btn {
    width: 100%;
    padding: 15px;
    background: rgba(66, 63, 68, 0.726);
    color: #fff;
    border: 1px solid rgba(66, 63, 68, 0.8);
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-btn:hover {
    background: rgba(66, 63, 68, 0.9);
    transform: translateY(-2px);
}

.welcome-user {
    background: rgba(66, 63, 68, 0.726);
    backdrop-filter: blur(15px);
    border-radius: 15px;
    border: 1px solid rgba(66, 63, 68, 0.8);
    overflow: hidden;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.welcome-user h2 {
    color: #fff;
    font-size: 1.1rem;
    margin: 0;
}

.logout-btn {
    background: rgba(66, 63, 68, 0.726);
    border: 1px solid rgba(66, 63, 68, 0.8);
    color: #fff;
    padding: 8px 15px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(66, 63, 68, 0.9);
    transform: translateY(-2px);
}

.hidden {
    display: none !important;
}

/* 모바일 기본 스타일 (768px 미만) */
.top-widgets {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* 모바일에서 left-section이 main-content의 패딩을 제대로 반영하도록 */
@media (max-width: 767px) {
    .main-content {
        padding: 20px;
        width: 100%;
        margin: 0 auto;
    }
    
    .left-section {
        width: 100%;
        margin: 0;
        gap: 10px;
    }
    
    .right-section {
        width: 100%;
    }
}

@media (min-width: 768px) {
    .main-content {
        gap: 10px;
        padding: 40px;
        width: 50%;
        margin-left: auto;
        margin-right: 20px;
        margin-top: 48px;
    }
    
    .welcome-message {
        grid-column: 1 / -1;
    }
    
    .left-section {
        position: fixed;
        left: 20px;
        top: 48px;
        width: calc(50% - 40px);
        height: calc(100vh - 80px);
        transform: none;
        margin-bottom: 0;
    }
    
    .right-section {
        grid-column: 1 / -1;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .top-widgets {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
}

@media (min-width: 1024px) {
    .main-content {
        gap: 10px;
        padding: 60px;
        width: 50%;
        margin-left: auto;
        margin-right: 20px;
        margin-top: 48px;
    }
    
    .welcome-message {
        grid-column: 1 / -1;
    }
    
    .left-section {
        position: fixed;
        left: 20px;
        top: 48px;
        width: calc(50% - 40px);
        transform: none;
    }
    
    .right-section {
        grid-column: 1 / -1;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .top-widgets {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
}