/* Custom styles for Japan Travel Expense Tracker */

body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Safe Area 배경 처리 */
html {
    background-color: #000000; /* 검은색 배경으로 Safe Area 채우기 */
}

/* 메인 컨텐츠 영역은 원래 색상 유지 */
body {
    background-color: #f8f9fa;
    min-height: 100vh;
}

/* 달력 스타일 */
.expense-calendar {
    width: 100%;
    max-width: 100%;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background-color: #dee2e6;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
}

.calendar-header {
    background-color: #6c757d;
    color: white;
    padding: 10px 5px;
    text-align: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.calendar-day {
    background-color: white;
    min-height: 80px;
    padding: 5px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    border: 1px solid #f8f9fa;
    transition: background-color 0.2s ease;
}

.calendar-day:hover {
    background-color: #f8f9fa;
}

.calendar-day.other-month {
    background-color: #f8f9fa;
    color: #6c757d;
}

.calendar-day.today {
    background-color: #e3f2fd;
    border: 2px solid #2196f3;
}

.calendar-day.has-expense {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    cursor: pointer;
}

.day-number {
    font-weight: bold;
    font-size: 0.9rem;
    margin-bottom: 3px;
}

.day-expense {
    font-size: 0.75rem;
    color: #dc3545;
    font-weight: bold;
    text-align: left;
}

/* 지출 내역 모달 스타일 */
.expense-detail-item {
    transition: background-color 0.2s ease;
}

.expense-detail-item:hover {
    background-color: #f8f9fa !important;
}

.expense-icon {
    width: 60px;
    text-align: center;
}

.expense-info h6 {
    font-weight: 600;
    color: #2c3e50;
}

.expense-amount {
    text-align: right;
    min-width: 120px;
}

#expenseDetailModal .modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

@media (max-width: 768px) {
    .calendar-day {
        min-height: 60px;
        padding: 3px;
    }

    .day-number {
        font-size: 0.8rem;
    }

    .day-expense {
        font-size: 0.7rem;
    }

    .calendar-header {
        padding: 8px 3px;
        font-size: 0.8rem;
    }

    .expense-detail-item .row {
        --bs-gutter-x: 0.5rem;
    }

    .expense-icon {
        width: 50px;
    }

    .expense-amount {
        min-width: 100px;
    }
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

.card {
    border: none;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease-in-out;
}

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

.bg-success {
    background: linear-gradient(135deg, #28a745, #20c997) !important;
}

.bg-danger {
    background: linear-gradient(135deg, #dc3545, #fd7e14) !important;
}

.bg-info {
    background: linear-gradient(135deg, #17a2b8, #6f42c1) !important;
}

.bg-warning {
    background: linear-gradient(135deg, #ffc107, #fd7e14) !important;
}

.expense-item {
    border-left: 4px solid #007bff;
    margin-bottom: 10px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.expense-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.category-food { border-left-color: #28a745 !important; }
.category-transport { border-left-color: #007bff !important; }
.category-accommodation { border-left-color: #6f42c1 !important; }
.category-admission { border-left-color: #fd7e14 !important; }
.category-other { border-left-color: #6c757d !important; }

.form-control:focus, .form-select:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.btn-primary {
    background: linear-gradient(135deg, #007bff, #0056b3);
    border: none;
    border-radius: 8px;
    padding: 10px 20px;
    font-weight: 500;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545, #c82333);
    border: none;
    border-radius: 6px;
}

.navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 모바일 터치 최적화 */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }

    .card-body {
        padding: 1rem;
    }

    .expense-item {
        padding: 15px;
        margin-bottom: 15px;
        min-height: 60px;
    }

    /* 터치 친화적 버튼 크기 */
    .btn {
        min-height: 48px;
        padding: 12px 20px;
        font-size: 1rem;
        font-weight: 500;
        border-radius: 8px;
    }

    .btn-sm {
        min-height: 40px;
        padding: 8px 16px;
        font-size: 0.9rem;
    }

    .btn-lg {
        min-height: 56px;
        padding: 16px 24px;
        font-size: 1.1rem;
    }

    /* 입력 필드 터치 최적화 */
    .form-control, .form-select {
        min-height: 48px;
        padding: 12px 16px;
        font-size: 1rem;
        border-radius: 8px;
    }

    /* 네비게이션 터치 영역 확대 */
    .nav-link {
        padding: 12px 16px !important;
        min-height: 48px;
        display: flex;
        align-items: center;
    }

    /* 카드 터치 영역 개선 */
    .card {
        margin-bottom: 20px;
    }

    .card-header {
        padding: 15px 20px;
        min-height: 60px;
        display: flex;
        align-items: center;
    }
}

/* Loading animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Gradient Login Button */
.btn-gradient-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.btn-gradient-primary:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
    color: white;
}

.btn-gradient-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.4);
}

/* 터치 제스처 및 스와이프 기능 */
.swipe-container {
    touch-action: pan-x;
    overflow-x: hidden;
    position: relative;
}

.swipe-item {
    transition: transform 0.3s ease-out;
    position: relative;
}

.swipe-item.swiping {
    transition: none;
}

.swipe-actions {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    display: flex;
    align-items: center;
    background: #dc3545;
    color: white;
    padding: 0 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.swipe-item.show-actions .swipe-actions {
    opacity: 1;
}

/* 터치 피드백 효과 */
.touch-feedback {
    position: relative;
    overflow: hidden;
}

.touch-feedback::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.touch-feedback.active::before {
    width: 200px;
    height: 200px;
}


/* Pull to refresh 스타일 */
.pull-ready {
    background: linear-gradient(to bottom, #e3f2fd 0%, transparent 100%);
    transition: background 0.3s ease;
}

/* 성능 최적화 - 하드웨어 가속 */
.card, .btn, .expense-item {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* 애니메이션 최적화 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

