/* 전역 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

/* 헤더 */
header {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

.header-content {
    max-width: 900px;
    margin: 0 auto;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

header p {
    font-size: 1.1em;
    opacity: 0.9;
    margin-bottom: 15px;
}

.header-notice {
    background-color: rgba(255, 255, 255, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    padding: 15px 20px;
    margin: 20px 0;
    backdrop-filter: blur(10px);
}

.notice-text {
    font-size: 0.95em;
    line-height: 1.6;
    margin: 0;
    opacity: 1;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
    margin-top: 15px;
}

.download-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.download-btn svg {
    flex-shrink: 0;
}

/* 폼 섹션 */
.form-section {
    padding: 30px 40px;
    border-bottom: 2px solid #f0f0f0;
}

.form-section:last-of-type {
    border-bottom: none;
}

.form-section h2 {
    color: #1e40af;
    font-size: 1.8em;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 3px solid #3b82f6;
}

/* 그리드 레이아웃 */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

/* 폼 그룹 */
.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #444;
    font-size: 0.95em;
}

.form-group label.required::after {
    content: ' *';
    color: #dc2626;
    font-weight: bold;
}

.form-group input,
.form-group select {
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    background-color: #fafafa;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input[readonly],
.form-group select[readonly] {
    background-color: #f3f4f6;
    cursor: not-allowed;
    color: #6b7280;
}

.form-group input[readonly]:focus {
    border-color: #e0e0e0;
    box-shadow: none;
}

.form-group small {
    margin-top: 5px;
    color: #777;
    font-size: 0.85em;
}

/* 체크박스 그룹 */
.checkbox-group {
    flex-direction: row;
    align-items: center;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
    margin: 0;
}

.checkbox-group input[type="checkbox"] {
    width: auto;
    margin-right: 8px;
    cursor: pointer;
    width: 20px;
    height: 20px;
}

/* 버튼 */
.form-actions {
    padding: 30px 40px;
    display: flex;
    gap: 15px;
    justify-content: center;
    background-color: #f8f9fa;
}

.btn-submit,
.btn-reset {
    padding: 15px 40px;
    font-size: 1.1em;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-submit {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

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

.btn-reset {
    background-color: #6b7280;
    color: white;
}

.btn-reset:hover {
    background-color: #4b5563;
    transform: translateY(-2px);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    header h1 {
        font-size: 2em;
    }

    header {
        padding: 30px 20px;
    }

    .header-notice {
        padding: 12px 15px;
    }

    .notice-text {
        font-size: 0.9em;
    }

    .download-btn {
        font-size: 0.9em;
        padding: 10px 20px;
    }

    .form-section {
        padding: 20px;
    }

    .form-actions {
        flex-direction: column;
        padding: 20px;
    }

    .btn-submit,
    .btn-reset {
        width: 100%;
    }
}

/* 로딩 애니메이션 */
.loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.loading.active {
    display: block;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

/* 사이드바 스타일 */
.sidebar {
    position: fixed;
    left: -350px;
    top: 0;
    width: 350px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.sidebar.open {
    left: 0;
}

.sidebar-header {
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h3 {
    margin: 0;
    font-size: 1.3em;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 2em;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 5px;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.quote-list {
    display: flex;
    flex-direction: column;
}

.quote-item {
    padding: 15px 20px;
    border-bottom: 1px solid #e5e7eb;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.quote-item:hover {
    background-color: #f3f4f6;
}

.quote-item-content {
    flex: 1;
    min-width: 0;
}

.quote-item-title {
    font-weight: 600;
    color: #1e40af;
    margin-bottom: 5px;
    font-size: 0.95em;
}

.quote-item-info {
    font-size: 0.85em;
    color: #6b7280;
}

.quote-item-time {
    font-size: 0.8em;
    color: #9ca3af;
    margin-top: 3px;
}

.quote-item-delete {
    background: none;
    border: none;
    color: #dc2626;
    cursor: pointer;
    padding: 5px;
    margin-left: 10px;
    opacity: 0;
    transition: opacity 0.2s;
}

.quote-item:hover .quote-item-delete {
    opacity: 1;
}

.quote-item-delete:hover {
    color: #991b1b;
}

.loading-text {
    text-align: center;
    padding: 20px;
    color: #9ca3af;
}

.empty-text {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
}

/* 사이드바 오버레이 */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 999;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* 햄버거 메뉴 버튼 */
.menu-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
    border: none;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.4);
    transition: all 0.3s ease;
    z-index: 998;
}

.menu-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(30, 64, 175, 0.6);
}

.menu-toggle:active {
    transform: translateY(0);
}

/* 홈 버튼 (결과 페이지용) */
.home-btn {
    position: fixed;
    top: 90px;
    left: 20px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    border: none;
    border-radius: 10px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(5, 150, 105, 0.4);
    transition: all 0.3s ease;
    z-index: 998;
    text-decoration: none;
}

.home-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(5, 150, 105, 0.6);
}

/* 반응형 - 사이드바 */
@media (max-width: 768px) {
    .sidebar {
        width: 80%;
        max-width: 300px;
        left: -100%;
    }
    
    .menu-toggle {
        top: 15px;
        left: 15px;
        width: 45px;
        height: 45px;
    }
    
    .home-btn {
        top: 75px;
        left: 15px;
        width: 45px;
        height: 45px;
    }
}

/* AI 플로팅 버튼 */
.ai-floating-btn {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.5);
    transition: all 0.3s ease;
    z-index: 997;
}

.ai-floating-btn:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 30px rgba(124, 58, 237, 0.7);
}

.ai-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    font-size: 0.7em;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    border: 2px solid white;
}

/* AI 모달 */
.ai-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1001;
    align-items: center;
    justify-content: center;
}

.ai-modal.active {
    display: flex;
}

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

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

.ai-modal-header {
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: white;
    padding: 20px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ai-modal-header h3 {
    margin: 0;
    font-size: 1.4em;
}

.ai-modal-body {
    padding: 25px;
}

.ai-instruction {
    color: #6b7280;
    margin-bottom: 15px;
    font-size: 0.95em;
    line-height: 1.5;
}

#aiInput {
    width: 100%;
    padding: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    font-size: 1em;
    font-family: 'Courier New', monospace;
    resize: vertical;
    min-height: 150px;
    transition: border-color 0.3s;
}

#aiInput:focus {
    outline: none;
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.ai-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.btn-ai-parse {
    flex: 1;
    background: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.btn-ai-parse:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.4);
}

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

.btn-ai-clear {
    background: #6b7280;
    color: white;
    border: none;
    padding: 15px 25px;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-ai-clear:hover {
    background: #4b5563;
}

.ai-status {
    margin-top: 15px;
    padding: 12px;
    border-radius: 8px;
    font-size: 0.9em;
    display: none;
}

.ai-status.show {
    display: block;
}

.ai-status.loading {
    background: #dbeafe;
    color: #1e40af;
}

.ai-status.success {
    background: #d1fae5;
    color: #065f46;
}

.ai-status.error {
    background: #fee2e2;
    color: #991b1b;
}

/* 반응형 - AI */
@media (max-width: 768px) {
    .ai-floating-btn {
        bottom: 20px;
        right: 20px;
        width: 55px;
        height: 55px;
    }
    
    .ai-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .ai-modal-body {
        padding: 20px;
    }
    
    .ai-actions {
        flex-direction: column;
    }
}
