/* ========================================
   날짜/시간 계산기 - 커스텀 스타일
   ======================================== */

/* ========================================
   1. 탭 네비게이션
   ======================================== */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid #e0e0e0;
    flex-wrap: wrap;
}

.tab-button {
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.tab-button:hover {
    color: #2196F3;
    background: #f5f5f5;
}

.tab-button.active {
    color: #2196F3;
    border-bottom-color: #2196F3;
}

.tab-button i {
    margin-right: 0.5rem;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

/* ========================================
   2. 카드 스타일
   ======================================== */
.calculator-card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

/* D-Day 탭의 row에 동일 높이 적용 */
#tab-dday .row {
    display: flex;
}

#tab-dday .row > [class*='col-'] {
    display: flex;
    flex-direction: column;
}

#tab-dday .row .calculator-card {
    height: 100%;
}

.calculator-card h5 {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.calculator-card h5 i {
    color: #2196F3;
}

/* ========================================
   3. 결과 카드
   ======================================== */
.result-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 8px 15px rgba(102, 126, 234, 0.3);
    margin: 1rem 0;
    animation: slideUp 0.5s ease;
}

.result-card.success {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

.result-card.warning {
    background: linear-gradient(135deg, #FF9800 0%, #f57c00 100%);
}

.result-card.danger {
    background: linear-gradient(135deg, #F44336 0%, #d32f2f 100%);
}

.result-card.info {
    background: linear-gradient(135deg, #2196F3 0%, #1976d2 100%);
}

.result-main {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 0.75rem 0;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.result-sub {
    font-size: 1rem;
    opacity: 0.9;
    margin: 0.4rem 0;
}

.result-detail {
    font-size: 0.9rem;
    opacity: 0.8;
    margin: 0.25rem 0;
}

/* ========================================
   4. D-Day 카운트다운
   ======================================== */
.countdown-container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin: 1rem 0;
}

.countdown-item {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 0.75rem 0.5rem;
    text-align: center;
}

.countdown-number {
    font-size: 2rem;
    font-weight: 700;
    display: block;
    margin-bottom: 0.3rem;
}

.countdown-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* ========================================
   5. 저장된 D-Day 목록
   ======================================== */
.dday-list {
    display: grid;
    gap: 1rem;
}

.dday-item {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
    border-left: 4px solid #2196F3;
}

.dday-item:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.dday-icon {
    font-size: 2.5rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border-radius: 10px;
}

.dday-content {
    flex: 1;
}

.dday-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.3rem;
}

.dday-date {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.3rem;
}

.dday-memo {
    font-size: 0.85rem;
    color: #999;
    font-style: italic;
}

.dday-info {
    text-align: right;
}

.dday-days {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2196F3;
    margin-bottom: 0.3rem;
}

.dday-days.past {
    color: #999;
}

.dday-days.today {
    color: #F44336;
}

.dday-status {
    font-size: 0.85rem;
    color: #666;
}

.dday-actions {
    display: flex;
    gap: 0.5rem;
}

.dday-actions button {
    padding: 0.5rem;
    background: #f5f5f5;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dday-actions button:hover {
    background: #e0e0e0;
    transform: scale(1.1);
}

/* ========================================
   6. 입력 그룹
   ======================================== */
.input-group-custom {
    display: flex;
    gap: 1rem;
    align-items: end;
    margin-bottom: 1rem;
}

.input-group-custom .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.4rem;
}

.form-group input[type="date"],
.form-group input[type="number"],
.form-group input[type="text"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

/* ========================================
   7. 프리셋 버튼
   ======================================== */
.preset-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 0.6rem;
    margin: 1rem 0;
}

.preset-button {
    padding: 0.75rem 0.5rem;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.preset-button:hover {
    border-color: #2196F3;
    background: #f5f9ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.preset-button.active {
    border-color: #2196F3;
    background: #2196F3;
    color: white;
}

.preset-button span {
    font-size: 1.3rem;
    display: block;
    margin-bottom: 0.3rem;
}

/* ========================================
   8. 정보 박스
   ======================================== */
.info-box {
    background: #e3f2fd;
    border-left: 4px solid #2196F3;
    border-radius: 8px;
    padding: 0.75rem 1.25rem;
    margin: 0.75rem 0;
}

.info-box.success {
    background: #e8f5e9;
    border-left-color: #4CAF50;
}

.info-box.warning {
    background: #fff3e0;
    border-left-color: #FF9800;
}

.info-box.danger {
    background: #ffebee;
    border-left-color: #F44336;
}

.info-box p {
    margin: 0.35rem 0;
    color: #555;
    font-size: 0.95rem;
}

.info-box strong {
    color: #333;
}

/* ========================================
   9. 통계 카드
   ======================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 1.25rem 1rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: #2196F3;
    margin: 0.4rem 0;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
}

.stat-card.success .stat-number {
    color: #4CAF50;
}

.stat-card.warning .stat-number {
    color: #FF9800;
}

.stat-card.danger .stat-number {
    color: #F44336;
}

/* ========================================
   10. 체크박스 스타일
   ======================================== */
.checkbox-group {
    display: flex;
    gap: 1.5rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-item label {
    cursor: pointer;
    margin: 0;
    color: #555;
    font-weight: 500;
}

/* ========================================
   11. 모달
   ======================================== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    animation: fadeIn 0.3s ease;
}

.modal-overlay.active {
    display: block;
}

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    z-index: 9999;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal.active {
    display: block;
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h5 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #999;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: #333;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ========================================
   12. 아이콘/색상 선택기
   ======================================== */
.icon-picker {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 0.5rem;
    margin: 1rem 0;
}

.icon-option {
    width: 100%;
    aspect-ratio: 1;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.icon-option:hover {
    border-color: #2196F3;
    background: #f5f9ff;
    transform: scale(1.1);
}

.icon-option.active {
    border-color: #2196F3;
    background: #2196F3;
}

.color-picker {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
    margin: 1rem 0;
}

.color-option {
    width: 100%;
    aspect-ratio: 1;
    border: 3px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.active {
    border-color: #333;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

/* ========================================
   13. 빈 상태
   ======================================== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #999;
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h5 {
    font-size: 1.2rem;
    color: #666;
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

/* ========================================
   14. 반응형
   ======================================== */
@media (max-width: 768px) {
    .tabs {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .tab-button {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .calculator-card {
        padding: 1.25rem;
        margin-bottom: 1rem;
    }

    .calculator-card h5 {
        font-size: 1.1rem;
    }

    .result-main {
        font-size: 2rem;
    }

    .result-sub {
        font-size: 0.9rem;
    }

    .result-detail {
        font-size: 0.85rem;
    }

    .countdown-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .countdown-number {
        font-size: 1.5rem;
    }

    .countdown-label {
        font-size: 0.8rem;
    }

    .preset-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }

    .preset-button {
        padding: 0.6rem 0.4rem;
        font-size: 0.8rem;
    }

    .preset-button span {
        font-size: 1.1rem;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .stat-card {
        padding: 1rem 0.75rem;
    }

    .stat-number {
        font-size: 1.75rem;
    }

    .stat-label {
        font-size: 0.85rem;
    }

    .dday-item {
        flex-direction: column;
        text-align: center;
        padding: 1.25rem;
    }

    .dday-info {
        text-align: center;
    }

    .input-group-custom {
        flex-direction: column;
    }

    .modal {
        width: 95%;
    }

    .icon-picker {
        grid-template-columns: repeat(6, 1fr);
    }

    .info-box {
        padding: 0.6rem 1rem;
    }

    .info-box p {
        font-size: 0.9rem;
        margin: 0.3rem 0;
    }

    /* 모바일에서는 동일 높이 제거 */
    #tab-dday .row {
        display: block;
    }

    #tab-dday .row > [class*='col-'] {
        display: block;
    }

    #tab-dday .row .calculator-card {
        height: auto;
    }
}

/* ========================================
   15. 애니메이션
   ======================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.pulse {
    animation: pulse 2s ease-in-out infinite;
}
