/*
 * Program Designer: 싸쓰개 (help@sasdog.com)
 * Related site: https://www.sasdog.com
 * 
 * 로또 번호 관리 시스템 - 커스텀 스타일
 * 레이아웃 및 사이드바 스타일 정의
 */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Pretendard', -apple-system, 'Microsoft YaHei', '微软雅黑', sans-serif;
    background-color: #f8f9fa;
    overflow-x: hidden;
}

.app-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 250px !important;
    height: 100vh !important;
    background-color: #2c3e50 !important;
    z-index: 1050 !important;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

.main-wrapper {
    margin-left: 250px !important;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: calc(100% - 250px) !important;
    position: relative;
}

.app-header {
    background-color: #ffffff;
    border-bottom: 1px solid #dee2e6;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 100%;
    z-index: 1000;
    position: sticky;
    top: 0;
}

/* 사이드바 토글 버튼 스타일 */
.sidebar-toggle {
    border: none;
    background: transparent;
    color: #2c3e50;
    cursor: pointer;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    color: #007bff;
    transform: scale(1.1);
}

.sidebar-toggle:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
    border-radius: 0.25rem;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid #34495e;
    background-color: #2c3e50;
    position: sticky;
    top: 0;
    z-index: 1055;
}

.sidebar-body {
    padding: 1rem 0;
}

.nav-link {
    color: #ecf0f1 !important;
    padding: 0.75rem 1.5rem;
    margin: 0.25rem 1rem;
    border-radius: 0.375rem;
    transition: all 0.3s ease;
    text-decoration: none;
    display: block;
}

.nav-link:hover {
    background-color: #34495e !important;
    transform: translateX(5px);
    color: #ffffff !important;
}

.nav-link.active {
    background-color: #007bff !important;
    color: #ffffff !important;
    box-shadow: 0 2px 4px rgba(0,123,255,0.3);
}

.app-main {
    flex: 1;
    padding: 2rem;
    background-color: #f8f9fa;
    width: 100%;
    margin-top: 1rem;
}

.app-footer {
    background-color: #ffffff;
    border-top: 1px solid #dee2e6;
    padding: 1rem 2rem;
    margin-top: auto;
    width: 100%;
}

.page-header {
    margin-bottom: 10px;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0;
    margin-top: 10px;
}

.breadcrumb {
    background: none;
    padding: 0;
    margin: 0;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: ">";
    color: #6c757d;
}

/* 페이징 네비게이션 간격 */
.pagination {
    margin-top: 10px;
}

/* 모달 헤더 스타일 */
.modal-header {
    background-color: #007bff;
    color: white;
    border-bottom: none;
}

.modal-header .modal-title {
    color: white !important;
    font-weight: 600;
}

.modal-header .btn-close {
    filter: invert(1);
    font-weight: 700;
    font-size: 1.2rem;
}

/* 모달 전체 스타일 */
.modal-content {
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.modal-body {
    background-color: transparent;
}

.modal-footer {
    background-color: transparent;
    border-top: none;
}

/* 모달 번호 입력 필드 스타일 */
.modal-body .row .col-md-1 {
    flex: 0 0 auto;
    width: calc(100% / 7);
    padding-left: 8px;
    padding-right: 8px;
}

.modal-body .form-label {
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
    text-align: center;
}

.modal-body .form-control {
    text-align: center;
    font-weight: 600;
}

/* 테이블 번호 스타일 */
.table .badge {
    font-size: 1rem;
    font-weight: 700;
    padding: 0 !important;
    border-radius: 50% !important;
    width: 2rem !important;
    height: 2rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
    min-width: 2rem !important;
    min-height: 2rem !important;
}

.table .badge.bg-danger {
    background-color: #dc3545 !important;
}

.table .badge.bg-warning {
    background-color: #fd7e14 !important;
    color: white !important;
}

.table .badge.bg-primary {
    background-color: #0d6efd !important;
    border-radius: 0.375rem;
    font-size: 0.9rem;
    padding: 0.4rem 0.8rem;
    min-width: auto;
    height: auto;
}

/* 확률 계산 페이지 배지 동그라미 강제 (모든 화면 크기) - 높은 우선순위 */
.badge.lotto-number-badge-large,
.badge.lotto-number-badge-large.bg-primary,
.table .badge.lotto-number-badge-large,
.table .badge.lotto-number-badge-large.bg-primary {
    border-radius: 50% !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    width: 2.5rem !important;
    height: 2.5rem !important;
    min-width: 2.5rem !important;
    min-height: 2.5rem !important;
    max-width: 2.5rem !important;
    max-height: 2.5rem !important;
    font-size: 1.375rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
}

/* 강제로 레이아웃 고정 */
.container-fluid {
    max-width: none !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Bootstrap 오버라이드 */
.row {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

.col, .col-1, .col-2, .col-3, .col-4, .col-5, .col-6, 
.col-7, .col-8, .col-9, .col-10, .col-11, .col-12,
.col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6,
.col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12,
.col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6,
.col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12 {
    padding-left: 15px !important;
    padding-right: 15px !important;
}

/* 사이드바 고정 강화 */
.app-sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 250px !important;
    height: 100vh !important;
    background-color: #2c3e50 !important;
    z-index: 1050 !important;
    overflow-y: auto;
    box-shadow: 2px 0 5px rgba(0,0,0,0.1);
}

/* 메인 래퍼 강화 */
.main-wrapper {
    margin-left: 250px !important;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: calc(100% - 250px) !important;
    position: relative;
}

/* 모바일 반응형 스타일 */
@media (max-width: 767.98px) {
    /* 사이드바 기본적으로 숨김 */
    .app-sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1060 !important;
    }
    
    /* 사이드바 표시 상태 */
    .app-sidebar.show {
        transform: translateX(0);
    }
    
    /* 메인 래퍼 전체 너비 */
    .main-wrapper {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    /* 헤더 스타일 조정 */
    .app-header {
        padding: 0.75rem 1rem;
    }
    
    /* 메인 콘텐츠 패딩 조정 */
    .app-main {
        padding: 1rem;
        margin-top: 0.5rem;
    }
    
    /* 페이지 타이틀 크기 조정 */
    .page-title {
        font-size: 1.5rem;
    }
    
    /* 사이드바 오버레이 */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 1055;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .sidebar-overlay.show {
        display: block;
        opacity: 1;
    }
    
    /* 모바일에서 사이드바 헤더 조정 */
    .sidebar-header {
        padding: 1rem;
    }
    
    .sidebar-header h4 {
        font-size: 1.1rem;
    }
    
    /* 모바일에서 네비게이션 링크 조정 */
    .nav-link {
        padding: 0.625rem 1rem;
        margin: 0.25rem 0.5rem;
        font-size: 0.9rem;
    }
    
    /* 모바일에서 푸터 조정 */
    .app-footer {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
    
    .app-footer .row {
        flex-direction: column;
        text-align: center !important;
    }
    
    .app-footer .col-md-6 {
        margin-bottom: 0.5rem;
    }
    
    /* 모바일에서 테이블 반응형 */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* 모바일에서 카드 패딩 조정 */
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* 모바일에서 버튼 크기 조정 */
    .btn-sm {
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
    }
    
    /* 모바일에서 컨테이너 패딩 조정 */
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* 모바일에서 탭 네비게이션 조정 */
    .nav-tabs {
        flex-wrap: wrap;
    }
    
    .nav-tabs .nav-item {
        margin-bottom: 0.5rem;
    }
    
    .nav-tabs .nav-link {
        font-size: 0.875rem;
        padding: 0.5rem 0.75rem;
    }
    
    /* 모바일에서 차트 높이 조정 */
    canvas {
        max-width: 100%;
        height: auto !important;
    }
    
    /* 모바일에서 번호 배지 크기 조정 */
    .badge {
        font-size: 0.875rem !important;
        width: 2rem !important;
        height: 2rem !important;
    }
    
    /* 로또 번호 배지 스타일 (데스크톱) */
    .lotto-number-badge {
        width: 2.5rem !important;
        height: 2.5rem !important;
        border-radius: 50% !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-weight: 700 !important;
        font-size: 1rem !important;
        flex-shrink: 0 !important;
        min-width: 2.5rem !important;
        min-height: 2.5rem !important;
    }
    
    /* 모바일에서 로또 번호 배지 크기 조정 */
    @media (max-width: 767.98px) {
        .lotto-number-badge {
            width: 2.2rem !important;
            height: 2.2rem !important;
            font-size: 0.9rem !important;
            min-width: 2.2rem !important;
            min-height: 2.2rem !important;
        }
        
        .lotto-number-container {
            gap: 0.5rem !important;
        }
    }
    
    /* 작은 모바일 화면 (360px 이하) */
    @media (max-width: 360px) {
        .lotto-number-badge {
            width: 2rem !important;
            height: 2rem !important;
            font-size: 0.85rem !important;
            min-width: 2rem !important;
            min-height: 2rem !important;
        }
        
        .lotto-number-container {
            gap: 0.375rem !important;
        }
    }
    
    /* 확률 계산 페이지용 큰 번호 배지 (PC 버전에서도 크게) */
    .lotto-number-badge-large {
        width: 2.5rem !important;
        height: 2.5rem !important;
        border-radius: 50% !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-weight: 700 !important;
        font-size: 1.375rem !important;
        flex-shrink: 0 !important;
        min-width: 2.5rem !important;
        min-height: 2.5rem !important;
        max-width: 2.5rem !important;
        max-height: 2.5rem !important;
        padding: 0 !important;
        margin: 0 !important;
        line-height: 1 !important;
        box-sizing: border-box !important;
        border: none !important;
        text-align: center !important;
        vertical-align: middle !important;
    }
    
    /* PC에서 bg-primary 배지 동그라미 강제 */
    .lotto-number-badge-large.bg-primary {
        border-radius: 50% !important;
        padding: 0 !important;
        width: 2.5rem !important;
        height: 2.5rem !important;
        font-size: 1.375rem !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
    }
    
    /* 동그라미 안 숫자 정렬 강화 */
    .lotto-number-badge-large > * {
        margin: 0 !important;
        padding: 0 !important;
        line-height: 1 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    /* 태블릿에서 큰 번호 배지 크기 조정 */
    @media (max-width: 991.98px) {
        .lotto-number-badge-large {
            width: 4.5rem !important;
            height: 4.5rem !important;
            font-size: 2rem !important;
            min-width: 4.5rem !important;
            min-height: 4.5rem !important;
        }
    }
    
    /* 모바일에서 큰 번호 배지 크기 조정 (한 줄에 맞게) */
    @media (max-width: 767.98px) {
        .lotto-number-badge-large {
            width: 2.8rem !important;
            height: 2.8rem !important;
            font-size: 1.2rem !important;
            min-width: 2.8rem !important;
            min-height: 2.8rem !important;
        }
        
        .lotto-number-container {
            gap: 0.5rem !important;
        }
    }
    
    @media (max-width: 480px) {
        .lotto-number-badge-large {
            width: 2.5rem !important;
            height: 2.5rem !important;
            font-size: 1.1rem !important;
            min-width: 2.5rem !important;
            min-height: 2.5rem !important;
        }
        
        .lotto-number-container {
            gap: 0.4rem !important;
        }
    }
    
    @media (max-width: 360px) {
        .lotto-number-badge-large {
            width: 2.2rem !important;
            height: 2.2rem !important;
            font-size: 1rem !important;
            min-width: 2.2rem !important;
            min-height: 2.2rem !important;
        }
        
        .lotto-number-container {
            gap: 0.3rem !important;
        }
    }
    
    /* 모바일에서 카드 그리드 조정 */
    .row .col-lg-4,
    .row .col-md-6 {
        margin-bottom: 1rem;
    }
}

/* 태블릿 반응형 스타일 */
@media (min-width: 768px) and (max-width: 991.98px) {
    .app-sidebar {
        width: 220px !important;
    }
    
    .main-wrapper {
        margin-left: 220px !important;
        width: calc(100% - 220px) !important;
    }
    
    .app-main {
        padding: 1.5rem;
    }
}

/* ----------------------------------------------------
   [NEW] Index.php 모바일 최적화 스타일 통합
   ---------------------------------------------------- */

/* 카드 스타일 개선 */
.form-check-card {
    transition: all 0.2s ease;
    background-color: #fff;
    border: 2px solid #e9ecef;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
}

.form-check-card:active { transform: scale(0.98); }

/* 선택된 상태 스타일 */
.form-check-card input[type="radio"]:checked ~ label,
.form-check-card:has(input[type="radio"]:checked) {
    background-color: #f0f7ff;
    border-color: #405189 !important;
    color: #405189;
}

.form-check-card:has(input[type="radio"]:checked) i {
    color: #405189 !important;
    transform: scale(1.1);
}

/* 아이콘 애니메이션 */
.form-check-card i { transition: all 0.3s ease; margin-bottom: 0.5rem; display: block; }

.bg-gradient-primary {
    background: linear-gradient(135deg, #405189 0%, #0ab39c 100%);
}

/* 로또 볼 디자인 개선 (Index 페이지용 오버라이드) */
.lotto-number-badge-large.mobile-opt {
    width: 40px !important;
    height: 40px !important;
    font-size: 18px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
    margin: 2px;
    box-shadow: 0 3px 5px rgba(0,0,0,0.2);
    background: radial-gradient(circle at 30% 30%, #405189, #2f3c6a);
    border: 2px solid rgba(255,255,255,0.2);
}

/* 컨트롤 버튼 모바일 최적화 */
.control-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 1rem;
}

#countDisplay {
    font-size: 1.5rem;
    width: 60px;
    text-align: center;
    font-weight: 800;
    color: #405189;
}

.btn-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

@media (max-width: 576px) {
    .lotto-number-badge-large.mobile-opt {
        width: 34px !important;
        height: 34px !important;
        font-size: 14px !important;
    }
    .card-header h5 { font-size: 1rem; }
    .method-desc { font-size: 0.75rem; }
    .method-title { font-size: 0.9rem; }
    .btn-lg-mobile { width: 100%; display: block; padding: 0.8rem; font-size: 1.1rem; }
}

/* 공개 로또 — 관리자 세션 시 root 진입 링크 */
.lotto-extra-nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.lotto-extra-nav__link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 700;
    text-decoration: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.lotto-extra-nav__link:hover {
    text-decoration: none;
    opacity: 0.92;
    transform: translateY(-1px);
}

.lotto-extra-nav__link--admin {
    background: linear-gradient(135deg, #405189 0%, #2c3e50 100%);
    color: #fff;
}

/* lotto/root/gemini_recommend.php */
.lotto-gemini-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 45vh;
    padding: 2rem 1rem;
}

.lotto-gemini-loading .lotto-gemini-spinner {
    width: 3rem;
    height: 3rem;
}

.lotto-gemini-balls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
    justify-content: center;
}

@media (min-width: 768px) {
    .lotto-gemini-balls {
        flex-wrap: nowrap !important;
    }
}

.lotto-gemini-results {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1rem;
    max-width: 72rem;
    margin: 0 auto;
}

@media (min-width: 576px) {
    .lotto-gemini-results {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (min-width: 992px) {
    .lotto-gemini-results {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

.lotto-gemini-set-card {
    height: 100%;
}

.lotto-gemini-set-card .card-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 6.75rem;
    padding: 1.5rem 1rem;
}

.lotto-gemini-ball {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
    color: #fff;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.lotto-gemini-ball--y { background-color: #fbc400; }
.lotto-gemini-ball--b { background-color: #69c8f2; }
.lotto-gemini-ball--r { background-color: #ff7272; }
.lotto-gemini-ball--g { background-color: #aaaaaa; }
.lotto-gemini-ball--gn { background-color: #b0d840; }

/* lotto/root/api_fetch.php — 처리 로그 테이블 */
.lotto-fetch-log-scroll {
    max-height: 480px;
    overflow-y: auto;
}

.lotto-fetch-log-col-round {
    width: 80px;
}

.lotto-fetch-log-col-status {
    width: 110px;
}

/* lotto_data.php — BS5 번호 공 */
.lotto-data-table .lotto-data-ball {
    font-size: 0.875rem;
    font-weight: 700;
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    min-height: 2rem;
    padding: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.lotto-data-table .lotto-data-ball--bonus {
    background-color: var(--bs-warning, #ffc107);
    color: var(--bs-dark, #212529);
}

.lotto-data-table .lotto-data-ball.bg-primary,
.lotto-data-table .lotto-data-ball.bg-success,
.lotto-data-table .lotto-data-ball.bg-danger,
.lotto-data-table .lotto-data-ball.bg-info,
.lotto-data-table .lotto-data-ball.bg-secondary,
.lotto-data-table .lotto-data-ball.bg-dark {
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    padding: 0;
}
