/* ============================================
   K-WordCloud - WordPress Compatible Styles
   ============================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;900&display=swap');

/* CSS Reset & Base */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #f8fafc;
    margin: 0;
    padding: 0;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

#root {
    min-height: 100vh;
}

/* ============================================
   Layout
   ============================================ */
.app-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f1f5f9;
}

@media (min-width: 768px) {
    .app-container {
        flex-direction: row;
    }
}

/* Sidebar */
.sidebar {
    width: 100%;
    background: white;
    border-right: 1px solid #e5e7eb;
    overflow-y: auto;
    padding: 1.25rem 1rem !important; /* 좌우 패딩을 2rem에서 1rem으로 줄임 */
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex-shrink: 0;
    box-sizing: border-box; /* 패딩이 너비에 포함되도록 설정 */
}

@media (min-width: 768px) {
    .sidebar {
        width: 380px; /* 사이드바 너비를 살짝 조절 (필요시) */
    }
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #f8fafc;
    overflow: hidden;
}

@media (min-width: 768px) {
    .main-content {
        padding: 3rem;
    }
}

.preview-container {
    width: 100%;
    max-width: 80rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* ============================================
   Header Section
   ============================================ */
.header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.header-icon {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, #2563eb, #4338ca);
    border-radius: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.header-icon svg {
    width: 1.5rem;
    height: 1.5rem;
}

.header-title {
    font-size: 1.5rem;
    font-weight: 900;
    color: #111827;
    letter-spacing: -0.025em;

   /* 추가/수정해야 할 속성 */
    margin: 0;             /* h1 기본 마진 제거 */
    line-height: 1;        /* 텍스트 높이를 1로 설정하여 상하 여백 제거 */
    display: flex;         /* 텍스트 자체도 flex로 정렬 보조 */
    align-items: center;
}

.header-subtitle {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

/* ============================================
   Form Controls
   ============================================ */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 700;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-label-indicator {
    width: 0.25rem;
    height: 1rem;
    background-color: #2563eb;
    border-radius: 9999px;
}

/* Textarea */
.textarea {
    width: 100%;
    height: 12rem;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 1rem;
    font-size: 0.875rem;
    outline: none;
    resize: none;
    background-color: #f9fafb;
    transition: all 0.2s;
}

.textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.textarea::placeholder {
    color: #9ca3af;
}

/* Select */
.select-wrapper {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem; /* 간격을 1rem에서 0.5rem으로 줄임 */
}

.select-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0; /* 내부 요소가 넘치지 않도록 방지 */
}

.select-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #9ca3af;
    margin-left: 0.25rem;
}

.select {
    width: 100%;
    /* 좌우 패딩을 줄여서 글자가 들어갈 공간 확보 (상하 0.6rem, 좌우 0.4rem) */
    padding: 0.6rem 0.4rem !important; 
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    /* 글자 크기를 0.875rem에서 0.8rem으로 살짝 줄임 */
    font-size: 0.8rem !important; 
    font-weight: 600;
    color: #374151;
    background-color: #f9fafb;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
    /* 긴 텍스트가 짤리지 않도록 설정 */
    white-space: nowrap;
    text-overflow: clip; 
    appearance: auto; /* 브라우저 기본 화살표 사용 (공간 확보에 유리) */
}

.select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* ============================================
   Shape Grid
   ============================================ */
.shape-grid {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important; /* 5등분 고정 */
    gap: 6px !important; /* 간격을 8px에서 6px로 줄여 공간 확보 */
    background-color: #f9fafb;
    border: 1px solid #f3f4f6;
    border-radius: 12px;
    padding: 8px !important; /* 내부 여백을 줄임 */
    width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important; /* 절대 삐져나가지 않게 설정 */
}

.shape-btn {
    width: 100% !important;
    min-width: 0 !important; /* 버튼이 너비보다 커지는 것을 방지 */
    aspect-ratio: 1 / 1.15; /* 높이를 살짝 줄여서 압축 */
    display: flex !important;
    flex-direction: column !important;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: white;
    border: 1px solid #e5e7eb;
    padding: 6px 2px !important; /* 버튼 내부 좌우 여백 최소화 */
    cursor: pointer;
    box-sizing: border-box !important;
}

.shape-btn:hover {
    border-color: #93c5fd;
    color: #3b82f6;
}

.shape-btn.active {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: scale(1.02);
}

.shape-btn svg {
    width: 18px !important; /* 아이콘 크기를 20px에서 18px로 조정 */
    height: 18px !important;
    margin-bottom: 4px;
}

/* 텍스트 라벨 표시 설정 */
.shape-btn-label {
    display: block !important;
    font-size: 8px !important; /* 텍스트 크기를 9px에서 8px로 미세 조정 */
    font-weight: 800;
    text-align: center;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* 글자가 너무 길면 ... 처리 */
}

.shape-btn.active .shape-btn-label {
    display: none;
}

/* ============================================
   Color Pickers
   ============================================ */
.color-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
    background-color: #f9fafb;
    border-radius: 1rem;
    border: 1px solid #f3f4f6;
}

.color-btn {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    border: 2px solid white;
    transition: all 0.2s;
    cursor: pointer;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.color-btn:hover {
    transform: scale(1.1);
}

.color-btn.active {
    border-color: #3b82f6;
    transform: scale(1.1);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* Palette Grid */
.palette-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.palette-btn {
    padding: 0.5rem;
    border-radius: 0.75rem;
    border: 1px solid #f3f4f6;
    text-align: left;
    transition: all 0.2s;
    cursor: pointer;
    background: white;
}

.palette-btn:hover {
    border-color: #93c5fd;
}

.palette-btn.active {
    background-color: rgba(239, 246, 255, 1);
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px #3b82f6;
}

.palette-name {
    font-size: 10px;
    font-weight: 700;
    color: #9ca3af;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

.palette-colors {
    display: flex;
    margin-left: -0.25rem;
}

.palette-color {
    width: 1rem;
    height: 1rem;
    border-radius: 9999px;
    border: 1px solid white;
    margin-left: -0.25rem;
}

/* ============================================
   Generate Button
   ============================================ */
.generate-btn {
    width: 100%;
    padding: 1.25rem;
    border-radius: 1rem;
    font-weight: 900;
    font-size: 1.125rem;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    background: linear-gradient(to right, #2563eb, #4338ca);
}

.generate-btn:hover:not(:disabled) {
    background: linear-gradient(to right, #1d4ed8, #3730a3);
}

.generate-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.generate-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    box-shadow: none;
}

.generate-btn svg {
    width: 1.5rem;
    height: 1.5rem;
}

.spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 3px solid white;
    border-top-color: transparent;
    border-radius: 9999px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   Preview Area
   ============================================ */
.preview-header {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

@media (min-width: 768px) {
    .preview-header {
        flex-direction: row;
    }
}

.preview-title {
    text-align: center;
}

@media (min-width: 768px) {
    .preview-title {
        text-align: left;
    }
}

.preview-title h2 {
    font-size: 1.5rem;
    font-weight: 900;
    color: #1f2937;
    letter-spacing: -0.025em;
}

.preview-title p {
    font-size: 0.875rem;
    color: #9ca3af;
    font-weight: 500;
}

.download-btn {
    padding: 0.75rem 1.5rem;
    background: white;
    border: 1px solid #e5e7eb;
    color: #374151;
    border-radius: 1rem;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.download-btn:hover {
    background-color: #f9fafb;
}

.download-btn:active {
    background-color: #f3f4f6;
}

.download-btn svg {
    width: 1.25rem;
    height: 1.25rem;
    color: #f43f5e;
}

/* Canvas Container */
.canvas-container {
    position: relative;
    border: 1px solid #e5e7eb;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    border-radius: 2.5rem;
    overflow: hidden;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    min-height: 600px;
    transition: all 0.2s;
}

.canvas-container:hover {
    box-shadow: 0 25px 50px -12px rgba(59, 130, 246, 0.1);
}

.canvas-inner {
    padding: 1rem;
    border-radius: 1.5rem;
    box-shadow: inset 0 2px 4px 0 rgba(0, 0, 0, 0.05);
    border: 1px solid #f9fafb;
    transition: background-color 0.2s;
}

.canvas-inner canvas {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Placeholder */
.placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
}

.placeholder-icon {
    width: 6rem;
    height: 6rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #3b82f6, #4f46e5);
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transform: rotate(12deg);
    transition: transform 0.3s;
}

.canvas-container:hover .placeholder-icon {
    transform: rotate(0deg);
}

.placeholder-icon svg {
    width: 3rem;
    height: 3rem;
}

.placeholder-title {
    font-size: 1.5rem;
    font-weight: 900;
    color: #1f2937;
    letter-spacing: -0.025em;
}

.placeholder-subtitle {
    font-size: 0.875rem;
    color: #9ca3af;
    margin-top: 0.5rem;
    font-weight: 500;
}


/* ============================================
   Keywords Section
   ============================================ */
.keywords-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .keywords-section {
        flex-direction: row;
    }
}

.keywords-card {
    flex: 1;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(4px);
    padding: 1.5rem;
    border-radius: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.4);
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.keywords-label {
    font-size: 10px;
    font-weight: 900;
    color: #3b82f6;
    text-transform: uppercase;
    letter-spacing: 0.2em;
}

.keywords-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #374151;
    margin-top: 0.25rem;
    margin-bottom: 0.75rem;
}

.keywords-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.keyword-tag {
    padding: 0.375rem 0.75rem;
    background: white;
    border: 1px solid #f3f4f6;
    border-radius: 9999px;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    font-size: 0.75rem;
    font-weight: 600;
    color: #4b5563;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.keyword-dot {
    width: 0.375rem;
    height: 0.375rem;
    border-radius: 9999px;
    background-color: #3b82f6;
}

.keywords-empty {
    font-size: 0.75rem;
    color: #9ca3af;
    font-style: italic;
}

/* ============================================
   Scrollbar
   ============================================ */
.shape-grid-container::-webkit-scrollbar {
    width: 4px;
}

.shape-grid-container::-webkit-scrollbar-track {
    background: transparent;
}

.shape-grid-container::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

.shape-grid-container::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

/* ============================================
   Utility Classes
   ============================================ */
.hidden {
    display: none !important;
}


/* ============================================
   모바일 화면(768px 미만) 상하 여백 제거 최종본
   ============================================ */
@media (max-width: 767px) {
    /* 1. 전체 컨테이너 및 본문 정렬 수정 */
    .app-container {
        height: auto !important; /* 전체 높이 고정 해제 */
        min-height: unset !important;
    }

    .main-content {
        padding: 1rem 0.75rem !important;
        display: block !important; /* flex 해제하여 수직 중앙 정렬 강제 종료 */
        height: auto !important;
        flex: none !important; /* 남은 공간을 차지하지 않도록 설정 */
    }

    /* 2. 프리뷰 컨테이너 내부 간격 최소화 */
    .preview-container {
        display: flex;
        flex-direction: column;
        gap: 0.5rem !important; /* 요소 간의 간격을 아주 좁게 */
        width: 100%;
        max-width: 100%;
    }

    /* 3. 워드클라우드 박스(회색 박스) 높이 최적화 */
    .canvas-container {
        min-height: unset !important; /* 최소 높이 설정 완전 삭제 */
        height: auto !important;
        padding: 0.5rem !important; /* 바깥 여백 축소 */
        margin: 0 !important;
        border-radius: 1rem !important;
        display: block !important; /* 내부 flex 정렬 해제 */
    }

    .canvas-inner {
        padding: 0 !important; /* 캔버스를 감싸는 박스 여백 제거 */
        border-radius: 0.75rem !important;
        width: 100% !important;
        overflow: hidden;
    }

    .canvas-inner canvas {
        width: 100% !important; /* 화면 너비에 꽉 차게 */
        height: auto !important; /* 비율에 맞게 높이 자동 조절 */
        display: block;
    }

    /* 4. 헤더 부분 여백 제거 */
    .preview-header {
        padding: 0 0.5rem !important;
        margin-bottom: 0 !important;
        flex-direction: column !important; /* 버튼과 제목 수직 배치 */
        align-items: flex-start !important;
        gap: 0.5rem !important;
    }

    .preview-title h2 {
        font-size: 1.1rem !important;
        margin-bottom: 0 !important;
    }

    .preview-title p {
        display: none; /* 모바일에서 불필요한 긴 설명 숨김 */
    }

    /* 5. 하단 키워드 섹션 여백 최소화 */
    .keywords-section {
        margin-top: 0 !important;
    }

    .keywords-card {
        padding: 0.75rem !important;
        background: white !important;
    }
}


/* ============================================
   SEO Content Section Styling
   ============================================ */
.seo-section {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    line-height: 1.7;
}

.seo-title {
    font-size: 1.5rem;
    font-weight: 900;
    color: #1f2937;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
    letter-spacing: -0.025em;
}

.seo-text p {
    margin-bottom: 1rem;
    color: #4b5563;
    font-size: 1rem;
}

.benefits-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.benefit-title {
    font-size: 1.125rem;
    font-weight: 800;
    color: #2563eb;
    margin-bottom: 0.5rem;
}

.benefit-desc {
    font-size: 0.9375rem;
    color: #6b7280;
}


/* ============================================
   Accordion FAQ Styling
   ============================================ */
.faq-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.faq-item {
    border: 1px solid #f3f4f6;
    border-radius: 12px;
    overflow: hidden;
    background: #f9fafb;
    transition: all 0.3s ease;
}

.faq-item.active {
    border-color: #3b82f6;
    background: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.05);
}

.faq-question {
    width: 100%;
    padding: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: none;
    border: none;
    outline: none;
    cursor: pointer;
    text-align: left;
    font-size: 1.05rem;
    font-weight: 700;
    color: #1f2937;
    transition: color 0.2s;
}

.faq-item:hover .faq-question {
    color: #d9e4fb;
}

.faq-icon {
    width: 20px;
    height: 20px;
    color: #9ca3af;
    transition: transform 0.3s ease, color 0.3s;
}

.faq-item.active .faq-icon {
    transform: rotate(180deg);
    color: #2563eb;
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, padding 0.3s ease;
    background: white;
}

.faq-item.active .faq-answer {
    max-height: 500px; /* 답변 길이에 따라 조절 */
    padding: 0 1.25rem 1.25rem 1.25rem;
}

.faq-answer p {
    font-size: 0.95rem;
    color: #4b5563;
    line-height: 1.6;
    border-top: 1px solid #f3f4f6;
    padding-top: 1rem;
}

/* 모바일 대응 */
@media (max-width: 767px) {
    .seo-title {
        font-size: 1.25rem;
    }
    .seo-section {
        gap: 1rem;
    }

   /* FAQ 컨테이너 간격 축소 */
    .faq-container {
        gap: 0.4rem !important;
        margin-top: 0.75rem !important;
    }

    /* FAQ 아이템 여백 및 둥글기 조절 */
    .faq-item {
        border-radius: 10px !important;
    }

    /* 질문 영역: 터치 영역 확보 및 폰트 축소 */
    .faq-question {
        padding: 1rem 0.85rem !important; /* 상하좌우 여백 압축 */
        font-size: 0.95rem !important; /* 모바일 가독성 폰트 */
        line-height: 1.4;
        gap: 10px; /* 글자와 아이콘 사이 간격 */
    }

    /* 질문 텍스트가 길어질 경우 처리 */
    .faq-question span {
        flex: 1; /* 텍스트가 공간을 다 차지하게 함 */
        word-break: keep-all; /* 단어 단위 줄바꿈으로 가독성 향상 */
    }

    /* 아이콘 크기 미세 조정 */
    .faq-icon {
        width: 18px !important;
        height: 18px !important;
        flex-shrink: 0; /* 아이콘이 찌그러지지 않게 고정 */
    }

    /* 답변 영역 여백 압축 */
    .faq-item.active .faq-answer {
        padding: 0 0.85rem 1rem 0.85rem !important;
    }

    .faq-answer p {
        font-size: 0.85rem !important; /* 답변 폰트 크기 축소 */
        padding-top: 0.75rem !important;
        line-height: 1.5;
        color: #6b7280; /* 가독성을 위한 약간 연한 회색 */
    }
}


/* 반응형 모바일 (640px 이상일 때 폰트 및 패딩 조정) */
@media (min-width: 640px) {
    .site-footer {
        font-size: 14px; /* sm:text-sm */
    }
    .footer-container {
        padding: 0 16px; /* sm:px-4 */
    }
}

/* 모바일에서 wpDiscuz 댓글창 좌우 여백 추가 */
@media screen and (max-width: 768px) {
#wpdcom {
padding-left: 20px !important;
padding-right: 20px !important;
box-sizing: border-box !important;
}
}