/* ============================================
   Palmistry AI - 개선된 스타일시트
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #8b5cf6;
    --secondary-color: #ec4899;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --dark-bg: #1f2937;
    --light-bg: #f9fafb;
    --border-color: #e5e7eb;
    --text-dark: #111827;
    --text-light: #6b7280;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.1);
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: var(--text-dark);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: slideUp 0.5s ease-out;
}

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

/* ============================================
   헤더
   ============================================ */

.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 50px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.header-content {
    position: relative;
    z-index: 1;
}

.header-content h1 {
    font-size: 2.8rem;
    margin-bottom: 10px;
    font-weight: 800;
    letter-spacing: -1px;
}

.header-content .tagline {
    font-size: 1.2rem;
    opacity: 0.95;
    font-weight: 300;
}

/* ============================================
   메인 콘텐츠
   ============================================ */

.main-content {
    padding: 50px 30px;
}

.hero {
    text-align: center;
    margin-bottom: 50px;
    animation: fadeIn 0.8s ease-out;
}

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

.hero h2 {
    font-size: 2.2rem;
    color: var(--text-dark);
    margin-bottom: 15px;
    font-weight: 700;
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-light);
    margin-bottom: 10px;
}

.price-info {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-top: 25px;
    padding: 15px;
    background: rgba(139, 92, 246, 0.05);
    border-radius: 8px;
    display: inline-block;
}

.price-info strong {
    font-size: 1.6rem;
    color: var(--secondary-color);
}

/* ============================================
   업로드 섹션
   ============================================ */

.upload-section {
    margin-bottom: 50px;
}

.upload-container {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.02) 0%, rgba(236, 72, 153, 0.02) 100%);
    padding: 40px;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.upload-container:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.upload-container h3 {
    font-size: 1.6rem;
    margin-bottom: 30px;
    color: var(--text-dark);
    font-weight: 700;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-dark);
    font-size: 1rem;
}

.form-group input[type="email"],
.form-group input[type="tel"],
.form-group input[type="date"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.form-group input[type="email"]:focus,
.form-group input[type="tel"]:focus,
.form-group input[type="date"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.1);
    background: rgba(139, 92, 246, 0.02);
}

.form-group input[type="email"]::placeholder,
.form-group input[type="tel"]::placeholder {
    color: var(--text-light);
}

/* ============================================
   파일 입력
   ============================================ */

.file-input-wrapper {
    position: relative;
    border: 3px dashed var(--primary-color);
    border-radius: 12px;
    padding: 40px 30px;
    text-align: center;
    cursor: pointer;
    background: white;
    transition: all 0.3s ease;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.file-input-wrapper:hover {
    background: rgba(139, 92, 246, 0.03);
    border-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.file-input-wrapper.dragover {
    background: rgba(139, 92, 246, 0.1);
    border-color: var(--secondary-color);
}

.file-input-wrapper input[type="file"] {
    display: none;
}

.file-input-label {
    display: block;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 1.05rem;
    transition: color 0.3s ease;
}

.file-input-wrapper:hover .file-input-label {
    color: var(--secondary-color);
}

.file-info {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-top: 8px;
}

.image-preview {
    margin-top: 25px;
    text-align: center;
    animation: fadeIn 0.5s ease-out;
}

.image-preview img {
    max-width: 100%;
    max-height: 350px;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--border-color);
}

/* ============================================
   버튼
   ============================================ */

.btn-submit,
.btn-payment,
.btn-secondary,
.btn-download {
    padding: 14px 32px;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 15px;
    text-transform: none;
    letter-spacing: 0.5px;
}

.btn-submit {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    font-size: 1.05rem;
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(139, 92, 246, 0.4);
}

.btn-submit:active:not(:disabled) {
    transform: translateY(-1px);
}

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

.btn-payment {
    background: var(--success-color);
    color: white;
    width: auto;
    margin-right: 10px;
    display: inline-block;
}

.btn-payment:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.3);
}

.btn-secondary {
    background: var(--border-color);
    color: var(--text-dark);
    width: auto;
    display: inline-block;
}

.btn-secondary:hover {
    background: #d1d5db;
    transform: translateY(-2px);
}

.btn-download {
    background: var(--warning-color);
    color: white;
    width: auto;
    display: inline-block;
}

.btn-download:hover {
    background: #d97706;
    transform: translateY(-2px);
}

/* ============================================
   로딩 스피너
   ============================================ */

.loading-spinner {
    text-align: center;
    padding: 50px 30px;
    animation: fadeIn 0.3s ease-out;
}

.spinner {
    border: 4px solid var(--light-bg);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.loading-spinner p {
    color: var(--text-light);
    font-weight: 500;
    font-size: 1.05rem;
}

/* ============================================
   결과 섹션
   ============================================ */

.result-section {
    margin-bottom: 50px;
    animation: slideUp 0.5s ease-out;
}

.result-container {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.02) 0%, rgba(16, 185, 129, 0.01) 100%);
    padding: 40px;
    border-radius: 12px;
    border-left: 5px solid var(--success-color);
    box-shadow: var(--shadow-md);
}

.result-container h3 {
    font-size: 1.6rem;
    margin-bottom: 25px;
    color: var(--text-dark);
    font-weight: 700;
}

.analysis-result {
    background: white;
    padding: 30px;
    border-radius: 10px;
    line-height: 1.9;
    color: var(--text-dark);
    margin-bottom: 25px;
    max-height: 700px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.analysis-result::-webkit-scrollbar {
    width: 10px;
}

.analysis-result::-webkit-scrollbar-track {
    background: var(--light-bg);
    border-radius: 10px;
}

.analysis-result::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

.analysis-result::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* 메인 섹션 헤더 (##) */
.analysis-result h2 {
    color: var(--primary-color);
    margin-top: 35px;
    margin-bottom: 20px;
    font-size: 1.5rem;
    font-weight: 800;
    padding-bottom: 12px;
    border-bottom: 3px solid rgba(139, 92, 246, 0.2);
}

.analysis-result h2:first-child {
    margin-top: 0;
}

/* 서브 섹션 헤더 (###) */
.analysis-result h3 {
    color: var(--secondary-color);
    margin-top: 28px;
    margin-bottom: 16px;
    font-size: 1.3rem;
    font-weight: 700;
    padding-left: 12px;
    border-left: 4px solid var(--secondary-color);
}

/* 세부 항목 헤더 (####) */
.analysis-result h4 {
    color: var(--primary-color);
    margin-top: 20px;
    margin-bottom: 10px;
    font-size: 1.1rem;
    font-weight: 600;
}

.analysis-result p {
    margin-bottom: 14px;
    color: var(--text-dark);
    font-size: 1rem;
}

.analysis-result strong {
    color: var(--primary-color);
    font-weight: 700;
}

.analysis-result em {
    color: var(--secondary-color);
    font-style: normal;
}

/* 리스트 스타일 개선 */
.analysis-result ul {
    margin: 15px 0;
    padding-left: 0;
    list-style: none;
}

.analysis-result li {
    margin-bottom: 10px;
    padding-left: 28px;
    position: relative;
    line-height: 1.7;
}

.analysis-result li::before {
    content: "▸";
    position: absolute;
    left: 8px;
    color: var(--primary-color);
    font-weight: bold;
    font-size: 1.1rem;
}

/* 인용문/강조 박스 */
.analysis-result blockquote {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(236, 72, 153, 0.05) 100%);
    border-left: 4px solid var(--primary-color);
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 6px;
    font-style: italic;
    color: var(--text-dark);
}

/* 구분선 */
.analysis-result hr {
    border: none;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--border-color), transparent);
    margin: 30px 0;
}

.result-actions {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.result-actions button {
    flex: 1;
    min-width: 150px;
    margin-top: 0;
}

/* ============================================
   정보 섹션
   ============================================ */

.info-section {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.02) 0%, rgba(59, 130, 246, 0.01) 100%);
    padding: 35px;
    border-radius: 12px;
    margin-bottom: 40px;
    border-left: 5px solid #3b82f6;
}

.info-section h3 {
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: var(--text-dark);
    font-weight: 700;
}

.info-section ul {
    list-style: none;
    padding-left: 0;
}

.info-section li {
    padding: 12px 0;
    padding-left: 35px;
    position: relative;
    color: var(--text-dark);
    font-size: 1rem;
    line-height: 1.6;
}

.info-section li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: var(--success-color);
    font-weight: bold;
    font-size: 1.3rem;
}

/* ============================================
   푸터
   ============================================ */

.footer {
    background: var(--dark-bg);
    color: white;
    text-align: center;
    padding: 25px;
    font-size: 0.95rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer p {
    margin: 5px 0;
}

/* ============================================
   모달
   ============================================ */

.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease-out;
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: white;
    padding: 40px;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    position: relative;
    animation: slideUp 0.3s ease-out;
}

.close-btn {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    color: var(--text-light);
    cursor: pointer;
    transition: color 0.3s ease;
    line-height: 1;
}

.close-btn:hover {
    color: var(--text-dark);
}

.modal-content h3 {
    margin-bottom: 25px;
    color: var(--text-dark);
    font-size: 1.5rem;
    font-weight: 700;
}

.payment-info {
    background: var(--light-bg);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 25px;
    border-left: 4px solid var(--primary-color);
}

.payment-info p {
    margin: 10px 0;
    color: var(--text-dark);
    font-size: 1rem;
}

.payment-method {
    margin: 25px 0;
    padding: 25px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--light-bg);
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    text-align: center;
}

/* ============================================
   에러 및 성공 메시지
   ============================================ */

.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    animation: slideDown 0.3s ease-out;
}

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

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--success-color);
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid var(--warning-color);
}

/* ============================================
   반응형 디자인
   ============================================ */

@media (max-width: 768px) {
    .header-content h1 {
        font-size: 2rem;
    }

    .hero h2 {
        font-size: 1.6rem;
    }

    .main-content {
        padding: 30px 20px;
    }

    .upload-container {
        padding: 25px;
    }

    .file-input-wrapper {
        padding: 30px 20px;
        min-height: 120px;
    }

    .result-container {
        padding: 25px;
    }

    .analysis-result {
        padding: 20px;
        max-height: 400px;
    }

    .result-actions {
        flex-direction: column;
    }

    .result-actions button {
        width: 100%;
        margin-right: 0;
    }

    .btn-payment,
    .btn-secondary,
    .btn-download {
        width: 100%;
        display: block;
        margin-right: 0;
        margin-bottom: 10px;
    }

    .modal-content {
        width: 95%;
        padding: 30px 20px;
    }

    .info-section {
        padding: 25px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 12px;
    }

    .header {
        padding: 35px 15px;
    }

    .header-content h1 {
        font-size: 1.5rem;
    }

    .header-content .tagline {
        font-size: 1rem;
    }

    .hero h2 {
        font-size: 1.3rem;
    }

    .hero p {
        font-size: 0.95rem;
    }

    .main-content {
        padding: 20px 15px;
    }

    .upload-container {
        padding: 20px;
    }

    .file-input-wrapper {
        padding: 20px 15px;
    }

    .form-group input[type="email"],
    .form-group input[type="tel"],
    .form-group input[type="date"] {
        font-size: 16px; /* iOS에서 줌 방지 */
    }

    .btn-submit,
    .btn-payment,
    .btn-secondary {
        padding: 12px 20px;
        font-size: 0.95rem;
    }

    .price-info {
        font-size: 1.1rem;
    }

    .price-info strong {
        font-size: 1.3rem;
    }

    .modal-content {
        width: 98%;
        padding: 25px 15px;
    }

    .result-container {
        padding: 20px;
    }

    .analysis-result {
        padding: 15px;
        max-height: 300px;
    }
}

/* ============================================
   접근성
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   인쇄 스타일
   ============================================ */

@media print {
    body {
        background: white;
        padding: 0;
    }

    .container {
        box-shadow: none;
        border-radius: 0;
    }

    .header {
        background: var(--dark-bg);
    }

    .upload-section,
    .btn-submit,
    .btn-payment,
    .modal {
        display: none;
    }

    .analysis-result {
        max-height: none;
        overflow: visible;
    }
}

