/**
 * 광남2동 체육회 - 공통 컴포넌트 스타일 (components.css)
 * 버튼, 폼, 모달, 테이블 등 재사용 가능한 컴포넌트 스타일을 정의합니다.
 */

/* === 버튼 스타일 === */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    text-align: center;
    line-height: 1.5;
    white-space: nowrap;
    user-select: none;
}

.btn:hover {
    transform: translateY(-1px);
    text-decoration: none;
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 버튼 크기 변형 */
.btn-sm {
    padding: 5px 15px;
    font-size: 12px;
}

.btn-lg {
    padding: 15px 30px;
    font-size: 16px;
}

/* 버튼 색상 변형 */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-primary:hover {
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #798b8d;
    color: white;
}

.btn-success {
    background-color: #27ae60;
    color: white;
}

.btn-success:hover {
    background-color: #229954;
    color: white;
}

.btn-warning {
    background-color: #f39c12;
    color: white;
}

.btn-warning:hover {
    background-color: #e67e22;
    color: white;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
    color: white;
}

.btn-info {
    background-color: #3498db;
    color: white;
}

.btn-info:hover {
    background-color: #2980b9;
    color: white;
}

.btn-light {
    background-color: #ecf0f1;
    color: #2c3e50;
    border: 1px solid #bdc3c7;
}

.btn-light:hover {
    background-color: #d5dbdb;
    color: #2c3e50;
}

.btn-outline {
    background: transparent;
    border: 2px solid currentColor;
}

.btn-outline.btn-primary {
    color: #667eea;
    border-color: #667eea;
}

.btn-outline.btn-primary:hover {
    background-color: #667eea;
    color: white;
}

/* === 폼 컴포넌트 === */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 500;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #ecf0f1;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
    background-color: white;
}

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

.form-control:disabled {
    background-color: #f8f9fa;
    opacity: 0.65;
    cursor: not-allowed;
}

.form-control.error {
    border-color: #e74c3c;
}

.form-control.success {
    border-color: #27ae60;
}

.form-error {
    color: #e74c3c;
    font-size: 12px;
    margin-top: 5px;
    display: none;
}

.form-error.show {
    display: block;
}

.form-help {
    color: #7f8c8d;
    font-size: 12px;
    margin-top: 5px;
}

/* === 입력 그룹 === */
.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    border-radius: 8px 0 0 8px;
    border-right: 0;
}

.input-group-append {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background-color: #ecf0f1;
    border: 2px solid #ecf0f1;
    border-left: 0;
    border-radius: 0 8px 8px 0;
    white-space: nowrap;
    font-size: 14px;
}

/* === 카드 컴포넌트 === */
.card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 20px rgba(0,0,0,0.08);
    overflow: hidden;
    margin-bottom: 20px;
    border: 1px solid #f1f3f4;
}

.card-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    background: #fafbfc;
}

.card-title {
    margin: 0;
    color: #2c3e50;
    font-size: 1.25rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-subtitle {
    margin: 5px 0 0 0;
    color: #7f8c8d;
    font-size: 0.9rem;
    font-weight: normal;
}

.card-body {
    padding: 20px;
}

.card-footer {
    padding: 15px 20px;
    background: #fafbfc;
    border-top: 1px solid #eee;
}

/* === 테이블 컴포넌트 === */
.table-container {
    overflow-x: auto;
    margin: -1px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: white;
}

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #555;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: #f8f9ff;
}

.table-striped tbody tr:nth-child(even) {
    background-color: #f9f9f9;
}

.table-striped tbody tr:nth-child(even):hover {
    background-color: #f8f9ff;
}

/* === 배지 컴포넌트 === */
.badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    white-space: nowrap;
}

.badge-primary {
    background-color: #e3f2fd;
    color: #1976d2;
}

.badge-success {
    background-color: #d4edda;
    color: #155724;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
}

.badge-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.badge-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

.badge-light {
    background-color: #f8f9fa;
    color: #6c757d;
}

.badge-secondary {
    background-color: #e9ecef;
    color: #495057;
}

.badge-dark {
    background-color: #343a40;
    color: white;
}

/* === 알림 컴포넌트 === */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    position: relative;
    border: 1px solid transparent;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border-color: #c3e6cb;
}

.alert-error,
.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
    border-color: #f5c6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border-color: #ffeaa7;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border-color: #bee5eb;
}

.alert-dismissible {
    padding-right: 50px;
}

.alert-close {
    position: absolute;
    top: 50%;
    right: 15px;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.3s ease;
}

.alert-close:hover {
    opacity: 1;
}

/* === 모달 컴포넌트 === */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1050;
    backdrop-filter: blur(2px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: fadeInUp 0.3s ease-out;
}

.modal-header {
    padding: 20px 25px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fafbfc;
}

.modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #2c3e50;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background-color: #f1f3f4;
    color: #666;
}

.modal-body {
    padding: 25px;
    max-height: 60vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 20px 25px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    background: #fafbfc;
}

/* === 페이지네이션 === */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 30px;
    gap: 5px;
}

.page-btn {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    color: #555;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 14px;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-btn:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    color: #495057;
    text-decoration: none;
}

.page-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.page-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* === 로딩 스피너 === */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-lg {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* === 드롭다운 === */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: white;
    border: 1px solid #e0e6ed;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    z-index: 1000;
    display: none;
    padding: 8px 0;
}

.dropdown-menu.show {
    display: block;
    animation: fadeInUp 0.2s ease-out;
}

.dropdown-item {
    display: block;
    padding: 8px 16px;
    color: #333;
    text-decoration: none;
    transition: all 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 14px;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
    color: #495057;
    text-decoration: none;
}

.dropdown-item.active {
    background-color: #667eea;
    color: white;
}

.dropdown-divider {
    height: 1px;
    background-color: #e9ecef;
    margin: 8px 0;
}

/* === 토스트 알림 === */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1060;
    max-width: 350px;
}

.toast {
    background: white;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    margin-bottom: 10px;
    overflow: hidden;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-header {
    padding: 12px 16px;
    background-color: #f8f9fa;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toast-body {
    padding: 16px;
}

/* === 읽기 전용 폼 스타일 === */
.form-control-readonly {
    background-color: #f8f9fa !important;
    border-color: #e9ecef !important;
    color: #6c757d !important;
    cursor: not-allowed;
    opacity: 0.8;
}

.form-control-readonly:focus {
    background-color: #f8f9fa !important;
    border-color: #e9ecef !important;
    box-shadow: none !important;
}

.disabled-label {
    color: #6c757d !important;
    font-weight: 400 !important;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: #495057;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 8px;
}

.readonly-section {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.editable-section {
    background-color: #fff;
    border: 2px solid #e3f2fd;
    border-radius: 8px;
    padding: 1.5rem;
}

.editable-section .section-title {
    color: #1976d2;
}

.text-muted {
    color: #6c757d !important;
}

.text-primary {
    color: #667eea !important;
}

/* 그리드 시스템 간단 구현 */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -0.75rem;
}

.col-md-6 {
    flex: 0 0 50%;
    max-width: 50%;
    padding: 0 0.75rem;
}

.mb-4 {
    margin-bottom: 1.5rem !important;
}

/* === 반응형 조정 === */
@media (max-width: 768px) {
    .btn {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .btn-sm {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .card {
        margin: 0 -5px 20px -5px;
        border-radius: 0;
    }
    
    .table-container {
        margin: 0 -20px;
    }
    
    .modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .pagination {
        flex-wrap: wrap;
        gap: 3px;
    }
    
    .page-btn {
        padding: 6px 10px;
        font-size: 12px;
        min-width: 36px;
        height: 36px;
    }
    
    /* 모바일에서 그리드 단일 컬럼으로 변경 */
    .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
    
    .readonly-section,
    .editable-section {
        padding: 1rem;
    }
}