/* ======================================================= */
/*                view-compact.css - 조밀한 디자인용 CSS              */
/* ======================================================= */

/* 기본 리셋 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: #f8f9fa;
    font-family: 'Noto Sans KR', Arial, sans-serif;
    line-height: 1.6;
}

/* ======================================================= */
/*                        헤더 스타일                        */
/* ======================================================= */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.6rem 0; /* 1rem에서 0.6rem으로 40% 감소 */
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    margin-bottom: 0.6rem; /* 1rem에서 0.6rem으로 40% 감소 */
    position: relative;
}

.header .container {
    position: relative;
}

.header-link {
    text-decoration: none;
    color: inherit;
    display: inline-block;
    transition: all 0.3s ease;
}

.header-link:hover {
    transform: translateY(-2px);
    text-shadow: 2px 2px 8px rgba(0,0,0,0.5);
}

.header-link:visited,
.header-link:focus {
    color: inherit;
    text-decoration: none;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    margin-bottom: 0.2rem; /* 0.3rem에서 0.2rem으로 약간 감소 */
    cursor: pointer;
}

.header p {
    font-size: 1rem;
    margin-top: 0.2rem; /* 0.3rem에서 0.2rem으로 약간 감소 */
    opacity: 0.9;
}

/* 헤더 네비게이션 (로그아웃 버튼) */
.header-nav {
    position: absolute;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
}

.logout-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid rgba(255,255,255,0.3);
}

.logout-btn:hover {
    background: rgba(255,255,255,0.3);
    color: white;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* 모바일에서 로그아웃 버튼 조정 */
@media (max-width: 768px) {
    .header-nav {
        position: static;
        transform: none;
        margin-top: 0.8rem;
        text-align: center;
    }
    
    .logout-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
}

/* ======================================================= */
/*                      컨테이너                           */
/* ======================================================= */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ======================================================= */
/*                       카드 스타일                        */
/* ======================================================= */
.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-bottom: 0.6rem; /* 1rem에서 0.6rem으로 40% 감소 */
    overflow: hidden;
}

.card-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.6rem 1.5rem; /* 상하 패딩을 1rem에서 0.6rem으로 40% 감소 */
    font-size: 1.2rem;
    font-weight: 600;
}

.card-body {
    padding: 0.9rem 1.5rem; /* 상하 패딩을 1.5rem에서 0.9rem으로 40% 감소 */
}

/* ======================================================= */
/*                     기본 정보 스타일                      */
/* ======================================================= */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.8rem;
    background: #f8f9fa;
    padding: 0.6rem 1rem; /* 상하 패딩을 1rem에서 0.6rem으로 40% 감소 */
    border-radius: 8px;
    margin-bottom: 0.5rem; /* 0.8rem에서 0.5rem으로 약간 더 감소 */
}

.info-item {
    display: flex;
    align-items: center;
}

.info-label {
    font-weight: 700;
    color: #495057;
    margin-right: 0.5rem;
}

.info-value {
    color: #212529;
}

/* ======================================================= */
/*                     사주 테이블 스타일                     */
/* ======================================================= */
.saju-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0.8rem 0;
}

.saju-table th {
    background: #f8f9fa;
    padding: 0.8rem;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    border: 2px solid #dee2e6;
    color: #495057;
}

.saju-table td {
    padding: 0.8rem;
    text-align: center;
    border: 1px solid #dee2e6;
    vertical-align: middle;
}

/* ======================================================= */
/*                   사주 글자 박스 스타일                    */
/* ======================================================= */
.saju-char-box {
    display: inline-block;
    width: 60px;
    height: 60px;
    line-height: 60px;
    font-size: 2.2rem;
    font-weight: 900;
    text-align: center;
    border-radius: 12px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    border: 3px solid rgba(255,255,255,0.3);
}

/* ======================================================= */
/*                      오행 색상                          */
/* ======================================================= */
.ohang-wood { 
    background: linear-gradient(135deg, #48C6EF 0%, #6F86D6 100%); 
    color: white; 
}

.ohang-fire { 
    background: linear-gradient(135deg, #FF6B6B 0%, #FFE66D 100%); 
    color: white; 
}

.ohang-earth { 
    background: linear-gradient(135deg, #FFD93D 0%, #FF6B35 100%); 
    color: white; 
}

.ohang-metal { 
    background: linear-gradient(135deg, #E0E0E0 0%, #BDBDBD 100%); 
    color: #333; 
    border-color: #999; 
}

.ohang-water { 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); 
    color: white; 
}

/* ======================================================= */
/*                    십신/운성 텍스트                       */
/* ======================================================= */
.sipsin-box {
    font-size: 1rem;
    font-weight: 700;
    color: #0d6efd;
    padding: 0.5rem;
}

.unseong-box {
    font-size: 1rem;
    font-weight: 700;
    color: #198754;
    padding: 0.5rem;
}

.sinsal-box, .jijanggan-box {
    font-size: 0.9rem;
    color: #6c757d;
    padding: 0.3rem;
}

/* ======================================================= */
/*                     대운 테이블                          */
/* ======================================================= */
.daeun-table .saju-char-box {
    width: 50px;
    height: 50px;
    line-height: 50px;
    font-size: 1.8rem;
}

/* ======================================================= */
/*                      버튼 스타일                         */
/* ======================================================= */
.btn-group {
    text-align: center;
    margin: 2rem 0;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    margin: 0 6px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-primary { 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); 
    color: white; 
}

.btn-success { 
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%); 
    color: white; 
}

.btn-warning { 
    background: linear-gradient(135deg, #FFD93D 0%, #FF6B35 100%); 
    color: white; 
}

.btn-danger { 
    background: linear-gradient(135deg, #FF416C 0%, #FF4B2B 100%); 
    color: white; 
}

/* ======================================================= */
/*                     기타 정보 스타일                      */
/* ======================================================= */
.info-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 0.8rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid #f1f3f4;
}

.info-row:last-child {
    border-bottom: none;
}

/* ======================================================= */
/*                    상담내용 툴팁 스타일                    */
/* ======================================================= */
.content-tooltip {
    position: relative;
    display: inline-block;
}

.content-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.content-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.tooltip-content {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 125%;
    left: 0;
    z-index: 1000;
    
    /* 말풍선 스타일 */
    background-color: #333;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    
    /* 크기 제한 */
    min-width: 200px;
    max-width: 500px;
    width: auto;
    
    /* 컨테이너를 완전히 초기화 */
    padding: 0;
    margin: 0;
    
    /* 애니메이션 */
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* 내부 텍스트를 위한 스타일 */
.tooltip-text {
    display: block;
    padding: 12px 16px;
    margin: 0;
    
    /* 텍스트 정렬 - 왼쪽 위부터 확실히 시작 */
    font-size: 0.9rem;
    line-height: 1.5;
    text-align: left;
    
    /* 공백과 줄바꿈 처리 */
    white-space: pre-wrap;
    word-wrap: break-word;
    word-break: break-word;
    
    /* 기본 스타일 완전 리셋 */
    text-indent: 0;
    text-transform: none;
    letter-spacing: normal;
    vertical-align: baseline;
    
    /* 위치를 확실히 고정 */
    position: relative;
    top: 0;
    left: 0;
}

/* 말풍선 꼬리 - 왼쪽으로 이동 */
.tooltip-content::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 20px; /* 왼쪽에서 20px 위치 */
    border: 8px solid transparent;
    border-top-color: #333;
}

/* 호버 시 툴팁 표시 */
.content-tooltip:hover .tooltip-content {
    visibility: visible;
    opacity: 1;
}

/* 화면 오른쪽 끝에서 잘리지 않도록 조정 */
.content-tooltip {
    position: relative;
}

.content-tooltip .tooltip-content {
    /* 뷰포트 오른쪽 끝을 넘지 않도록 */
    right: auto;
    left: 0;
}

/* 화면 오른쪽에 여유공간이 부족할 때 왼쪽으로 이동 */
@media (max-width: 768px) {
    .tooltip-content {
        max-width: 90vw; /* 뷰포트 너비의 90% */
        min-width: 200px;
        font-size: 0.85rem;
        padding: 10px 12px;
        left: -50px; /* 모바일에서 더 왼쪽으로 */
    }
    
    .tooltip-content::after {
        left: 70px; /* 꼬리 위치도 조정 */
    }
    
    .content-btn {
        font-size: 0.85rem;
        padding: 5px 10px;
    }
}

/* 작은 화면에서 말풍선이 화면을 벗어나지 않도록 */
/* ======================================================= */
/*                   write.php 전용 스타일                  */
/* ======================================================= */

/* 메인 컨테이너 */
.write-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.write-form {
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.1);
    overflow: hidden;
    margin-bottom: 1rem;
}

.form-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem 2rem;
    text-align: center;
}

.form-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.form-subtitle {
    opacity: 0.9;
    font-size: 0.95rem;
}

.form-body {
    padding: 1.8rem 2rem;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
    margin-bottom: 1.5rem;
}

.form-row {
    grid-column: 1 / -1;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.form-label {
    font-weight: 600;
    color: #495057;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.form-input {
    padding: 0.8rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
    transform: translateY(-1px);
}

.form-select {
    padding: 0.8rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 0.95rem;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
}

.form-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1rem;
    background: #f8f9fa;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.form-checkbox:hover {
    background: #e9ecef;
    border-color: #667eea;
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #667eea;
    cursor: pointer;
}

.checkbox-label {
    font-weight: 500;
    color: #495057;
    cursor: pointer;
    user-select: none;
    font-size: 0.95rem;
}

.date-time-group {
    display: flex;
    gap: 0.8rem;
    align-items: end;
}

.date-time-group .form-group {
    flex: 1;
}

.btn-group {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.8rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e9ecef;
}

.btn {
    padding: 0.9rem 1.8rem;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-width: 130px;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(108, 117, 125, 0.3);
}

/* write.php 반응형 디자인 */
@media (max-width: 768px) {
    .write-container {
        padding: 0 10px;
    }

    .form-body {
        padding: 1.2rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .form-header {
        padding: 1.2rem;
    }

    .form-title {
        font-size: 1.4rem;
    }

    .form-subtitle {
        font-size: 0.9rem;
    }

    .date-time-group {
        flex-direction: column;
        gap: 1rem;
    }

    .btn-group {
        flex-direction: column;
        margin-top: 1.5rem;
        padding-top: 1.2rem;
    }

    .btn {
        width: 100%;
        padding: 0.8rem 1.5rem;
    }

    .form-input, .form-select {
        padding: 0.7rem 0.9rem;
    }

    .form-checkbox {
        padding: 0.7rem 0.9rem;
    }
}

/* 폼 애니메이션 */
.form-group {
    animation: slideUp 0.6s ease forwards;
    opacity: 0;
    transform: translateY(20px);
}

.form-group:nth-child(1) { animation-delay: 0.1s; }
.form-group:nth-child(2) { animation-delay: 0.2s; }
.form-group:nth-child(3) { animation-delay: 0.3s; }
.form-group:nth-child(4) { animation-delay: 0.4s; }
.form-group:nth-child(5) { animation-delay: 0.5s; }

/* ======================================================= */
/*                        푸터                            */
/* ======================================================= */
.footer {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 2.5rem;
}

.footer p {
    margin: 0.4rem 0;
    opacity: 0.9;
}

/* ======================================================= */
/*                   index.php 전용 스타일                 */
/* ======================================================= */

/* 메인 컨테이너 */
.main-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 상단 정보 바 */
.info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f8f9fa;
    padding: 0.8rem 1.2rem;
    border-radius: 8px;
    margin-bottom: 0.8rem;
    border: 1px solid #e9ecef;
}

.total-info {
    font-weight: 600;
    color: #495057;
}

.total-count {
    color: #667eea;
    font-weight: 700;
}

/* 검색 폼 */
.search-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.search-select {
    min-width: 100px;
    padding: 0.4rem 0.6rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.9rem;
}

.search-input {
    min-width: 150px;
    padding: 0.4rem 0.8rem;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 0.9rem;
}

.search-input:focus, .search-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.25);
}

/* 액션 버튼들 */
.action-btn {
    padding: 0.4rem 0.8rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-search {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-search:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.btn-add {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-add:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(17, 153, 142, 0.3);
}

/* 테이블 스타일 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}

.data-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0.8rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.95rem;
}

.data-table td {
    padding: 0.8rem;
    text-align: center;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.data-table tr:hover {
    background-color: #f8f9fa;
}

.data-table tr:last-child td {
    border-bottom: none;
}

/* 이름 링크 스타일 */
.name-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.name-link:hover {
    color: #764ba2;
    text-decoration: underline;
}

/* 빈 데이터 메시지 */
.empty-message {
    padding: 2rem;
    text-align: center;
    color: #6c757d;
    font-style: italic;
}

/* 페이지네이션 */
.pagination-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
}

.page-info {
    color: #6c757d;
    font-size: 0.9rem;
}

.pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 0.3rem;
}

.page-item {
    display: inline-block;
}

.page-link {
    display: block;
    padding: 0.5rem 0.8rem;
    color: #667eea;
    text-decoration: none;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.page-link:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.page-item.active .page-link {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-color: #667eea;
}

.page-item.disabled .page-link {
    color: #6c757d;
    background: #f8f9fa;
    border-color: #dee2e6;
    cursor: not-allowed;
}

.page-item.disabled .page-link:hover {
    background: #f8f9fa;
    color: #6c757d;
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .info-bar {
        flex-direction: column;
        gap: 0.8rem;
        align-items: stretch;
    }
    
    .search-form {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .search-input {
        min-width: 120px;
    }
    
    .data-table {
        font-size: 0.85rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.6rem 0.4rem;
    }
    
    .pagination-wrapper {
        flex-direction: column;
        gap: 0.8rem;
    }
    
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .data-table {
        font-size: 0.8rem;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem 0.3rem;
    }
    
    .page-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }
}

/* ======================================================= */
/*                      반응형 디자인                       */
/* ======================================================= */
@media (max-width: 768px) {
    .header {
        padding: 0.5rem 0; /* 0.8rem에서 0.5rem으로 더 감소 */
        margin-bottom: 0.5rem; /* 0.8rem에서 0.5rem으로 더 감소 */
    }
    
    .header h1 { 
        font-size: 1.8rem; 
    }
    
    .card {
        margin-bottom: 0.5rem; /* 0.8rem에서 0.5rem으로 더 감소 */
    }
    
    .card-header {
        padding: 0.5rem 1rem; /* 상하 패딩을 더 감소 */
    }
    
    .card-body {
        padding: 0.6rem 1rem; /* 상하 패딩을 더 감소 */
    }
    
    .info-grid { 
        grid-template-columns: 1fr; 
        gap: 0.6rem;
        padding: 0.5rem 0.8rem; /* 상하 패딩을 더 감소 */
    }
    
    .saju-char-box { 
        width: 45px; 
        height: 45px; 
        line-height: 45px; 
        font-size: 1.6rem; 
    }
    
    .daeun-table .saju-char-box {
        width: 40px;
        height: 40px;
        line-height: 40px;
        font-size: 1.4rem;
    }
    
    .btn { 
        padding: 8px 14px; 
        margin: 3px; 
        font-size: 0.9rem;
    }
    
    .btn-group {
        margin: 1.2rem 0; /* 1.5rem에서 1.2rem으로 감소 */
    }
    
    .footer {
        padding: 1rem 0; /* 1.2rem에서 1rem으로 감소 */
        margin-top: 1.5rem; /* 2rem에서 1.5rem으로 감소 */
    }
}