/* 세무인사이드 공통 스타일 */

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

:root {
    --primary-color: #667eea;
    --primary-dark: #5a6fd8;
    --secondary-color: #764ba2;
    --success-color: #28a745;
    --error-color: #dc3545;
    --warning-color: #ffc107;
    --light-gray: #f8f9fa;
    --medium-gray: #6c757d;
    --dark-gray: #333;
    --border-color: #e1e5e9;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-gray);
    background: var(--light-gray);
}

/* 컨테이너 */
.container {
    background: white;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.page-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

/* 헤더 */
.header {
    background: var(--primary-color);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header h1, .header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.header .logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name {
    font-weight: 500;
}

/* 네비게이션 */
.nav-menu {
    display: flex;
    gap: 5px;
}

.nav-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.3s;
    font-weight: 500;
}

.nav-link:hover, .nav-link.active {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* 버튼 */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--medium-gray);
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-success:hover {
    background: #218838;
}

.btn-outline {
    background: transparent;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

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

.btn-small {
    padding: 8px 16px;
    font-size: 12px;
}

/* 폼 요소 */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--dark-gray);
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

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

.form-control.error {
    border-color: var(--error-color);
}

.form-control.success {
    border-color: var(--success-color);
}

/* 카드 */
.card {
    background: white;
    border: 2px solid #f0f0f0;
    border-radius: 12px;
    padding: 24px;
    transition: all 0.3s;
    box-shadow: var(--shadow);
}

.card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.card-header {
    margin-bottom: 16px;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--dark-gray);
    margin-bottom: 8px;
}

.card-subtitle {
    color: var(--medium-gray);
    font-size: 0.9rem;
}

.card-body {
    margin-bottom: 16px;
}

.card-footer {
    border-top: 1px solid #f0f0f0;
    padding-top: 16px;
    margin-top: 16px;
}

/* 그리드 */
.grid {
    display: grid;
    gap: 20px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* 알림 */
.alert {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    animation: slideIn 0.3s ease-out;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.alert.success {
    background: var(--success-color);
}

.alert.error {
    background: var(--error-color);
}

.alert.warning {
    background: var(--warning-color);
    color: var(--dark-gray);
}

.alert.info {
    background: #17a2b8;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* 로딩 스피너 */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 유틸리티 */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 3rem; }

.hidden { display: none !important; }
.visible { display: block !important; }

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 반응형 */
@media (max-width: 768px) {
    .page-container {
        padding: 10px;
    }
    
    .container {
        border-radius: 15px;
    }
    
    .header {
        padding: 15px 20px;
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .btn {
        padding: 14px 20px;
    }
    
    .alert {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .header h1, .header h2 {
        font-size: 1.25rem;
    }
    
    .card {
        padding: 16px;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* 동기화 상태 알림 스타일 */
.sync-status-alert {
    margin-bottom: 20px;
}

.sync-status-alert .alert {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid transparent;
}

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

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

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

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

.sync-status-alert .alert i {
    font-size: 16px;
}

.sync-status-alert .btn {
    margin-left: auto;
}

/* 텍스트 색상 유틸리티 */
.text-success {
    color: #28a745 !important;
}

.text-warning {
    color: #ffc107 !important;
}

.text-danger {
    color: #dc3545 !important;
}

.text-info {
    color: #17a2b8 !important;
}

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

/* 문제 카드 스타일 */
.question-card {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

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

.question-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.question-type {
    background: #007bff;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.question-difficulty {
    background: #ffc107;
    color: #212529;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.data-source {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-source.mock {
    background: #6c757d;
    color: white;
}

.data-source.local {
    background: #fd7e14;
    color: white;
}

.data-source.supabase {
    background: #28a745;
    color: white;
}

.question-content-preview {
    margin-bottom: 15px;
    line-height: 1.6;
    color: #495057;
}

.question-meta {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.category {
    background: #e9ecef;
    color: #495057;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.tag {
    background: #f8f9fa;
    color: #6c757d;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    border: 1px solid #dee2e6;
}

.question-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.question-actions .btn {
    font-size: 12px;
    padding: 6px 12px;
}

/* Mock 데이터 카드 스타일 */
.question-card.mock-data {
    border-left: 4px solid #6c757d;
}

/* Local 데이터 카드 스타일 */
.question-card.local-data {
    border-left: 4px solid #fd7e14;
}

/* Supabase 데이터 카드 스타일 */
.question-card.supabase-data {
    border-left: 4px solid #28a745;
}

/* 오류 보고 시스템 스타일 */
.error-report-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: #dc3545;
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    /* 더 눈에 잘 띄도록 개선 */
    backdrop-filter: blur(10px);
}

.error-report-btn:hover {
    background: #c82333;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.6);
}

.error-report-btn:active {
    transform: scale(0.95);
}

.error-report-btn.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0);
    }
}

/* 오류 보고 버튼 대체 텍스트 */
.error-report-fallback {
    display: none;
    font-size: 20px;
}

/* 오류 보고 모달 */
.error-report-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease-out;
}

.error-report-modal.show {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(10px);
    }
}

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

.error-report-content {
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    border-radius: 20px;
    padding: 35px;
    max-width: 550px;
    width: 92%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.15),
        0 10px 20px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    animation: slideInUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    position: relative;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.error-report-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid transparent;
    position: relative;
}

.error-report-header::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #dc3545, #e74c3c, #dc3545);
    border-radius: 1px;
}

.error-report-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #2c3e50;
    display: flex;
    align-items: center;
    gap: 12px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.error-report-title i {
    color: #dc3545;
    font-size: 1.4rem;
    animation: bugPulse 2s infinite;
}

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

.error-report-close {
    background: linear-gradient(145deg, #f8f9fa, #e9ecef);
    border: 1px solid #dee2e6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    color: #6c757d;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.error-report-close:hover {
    background: linear-gradient(145deg, #dc3545, #e74c3c);
    color: white;
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.error-report-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.error-report-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.error-report-form label {
    font-size: 15px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-report-form label::before {
    content: '✏️';
    font-size: 14px;
}

.error-report-textarea {
    width: 100%;
    min-height: 140px;
    padding: 16px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    resize: vertical;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: linear-gradient(145deg, #ffffff, #f8f9fa);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.error-report-textarea:focus {
    outline: none;
    border-color: #dc3545;
    box-shadow: 
        0 0 0 3px rgba(220, 53, 69, 0.1),
        inset 0 2px 4px rgba(0, 0, 0, 0.06);
    background: #ffffff;
    transform: translateY(-1px);
}

.error-report-textarea::placeholder {
    color: #6c757d;
    opacity: 0.8;
}

.error-report-info {
    background: linear-gradient(145deg, #e3f2fd, #f0f8ff);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #bbdefb;
    border-left: 4px solid #2196f3;
    font-size: 14px;
    color: #1565c0;
    line-height: 1.6;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.1);
    position: relative;
    overflow: hidden;
}

.error-report-info::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, #2196f3, #42a5f5, #2196f3);
}

.error-report-info h4 {
    margin: 0 0 12px 0;
    color: #1565c0;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.error-report-info h4::before {
    content: 'ℹ️';
    font-size: 16px;
}

.error-report-info ul {
    margin: 12px 0 0 0;
    padding-left: 20px;
}

.error-report-info li {
    margin-bottom: 6px;
    position: relative;
}

.error-report-info li::marker {
    color: #2196f3;
}

.error-report-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.error-report-submit {
    background: linear-gradient(145deg, #dc3545, #e74c3c);
    color: white;
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
    position: relative;
    overflow: hidden;
}

.error-report-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.error-report-submit:hover {
    background: linear-gradient(145deg, #c82333, #dc3545);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(220, 53, 69, 0.4);
}

.error-report-submit:hover::before {
    left: 100%;
}

.error-report-submit:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.error-report-submit:disabled {
    background: var(--medium-gray);
    cursor: not-allowed;
    transform: none;
}

.error-report-cancel {
    background: transparent;
    color: var(--medium-gray);
    padding: 12px 24px;
    border: 2px solid var(--medium-gray);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.error-report-cancel:hover {
    background: var(--medium-gray);
    color: white;
}

.error-report-loading {
    display: none;
    align-items: center;
    gap: 8px;
}

.error-report-loading.show {
    display: flex;
}

.error-report-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* 모바일 대응 */
@media (max-width: 768px) {
    .error-report-btn {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .error-report-content {
        padding: 20px;
        margin: 20px;
        width: calc(100% - 40px);
    }
    
    .error-report-title {
        font-size: 1.25rem;
    }
    
    .error-report-actions {
        flex-direction: column;
    }
    
    .error-report-submit,
    .error-report-cancel {
        width: 100%;
        justify-content: center;
    }
}
