/* Thought Clarifier - Notion-like UI */

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

:root {
  --font-sans: "Inter", sans-serif;
  --text-color: rgb(25, 25, 24);
  --bg-color: #fafafa;
  --border-color: rgba(55, 53, 47, 0.12);
  --space-16: 16px;
  --space-24: 24px;
  --space-32: 32px;
}

body {
    font-family: var(--font-sans);
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--space-32) var(--space-24);
}

/* ========== APP HEADER ========== */
.app-header {
    text-align: center;
    margin-bottom: var(--space-24);
    padding: var(--space-16) var(--space-24);
    margin: calc(-1 * var(--space-32)) calc(-1 * var(--space-24)) var(--space-24);
}

.app-header__title {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.025em;
    color: var(--text-color);
    margin: 0;
    padding-bottom: var(--space-16);
}

.app-header__title::after {
    content: "";
    display: block;
    width: 40%;
    height: 1px;
    background: var(--border-color);
    margin: var(--space-16) auto 0;
}

/* Mobile */
@media (max-width: 768px) {
    .container {
        padding: var(--space-24) var(--space-16);
    }

    .app-header {
        padding: 12px var(--space-16);
        margin: calc(-1 * var(--space-24)) calc(-1 * var(--space-16)) var(--space-24);
    }

    .app-header__title {
        font-size: 28px;
    }
}

/* Input Section */
.input-section {
    margin-bottom: 32px;
}

.input-card {
    background: white;
    border-radius: 12px;
    padding: 32px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.input-wrapper {
    margin-bottom: 24px;
}

.input-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: rgba(25, 25, 24, 0.6);
    margin-bottom: 8px;
}

textarea {
    width: 100%;
    min-height: 160px;
    padding: 16px;
    font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 18px;
    font-weight: 400;
    line-height: 1.55;
    color: rgb(25, 25, 24);
    background: rgba(55, 53, 47, 0.04);
    border: 0.5px solid rgba(55, 53, 47, 0.16);
    border-radius: 8px;
    outline: none;
    resize: vertical;
    transition: border-color 0.2s ease, background 0.2s ease;
}

textarea:focus {
    border-color: #2383E2;
    background: white;
}

textarea::placeholder {
    color: rgba(25, 25, 24, 0.4);
}

/* Mode Selection */
.mode-section {
    margin-bottom: 24px;
}

.mode-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: rgba(25, 25, 24, 0.6);
    margin-bottom: 12px;
}

.mode-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 8px;
    background: rgba(55, 53, 47, 0.04);
    border: 0.5px solid rgba(55, 53, 47, 0.12);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.mode-btn:hover {
    background: rgba(55, 53, 47, 0.08);
    border-color: rgba(55, 53, 47, 0.2);
}

.mode-btn.active {
    background: rgba(35, 131, 226, 0.08);
    border-color: #2383E2;
}

.mode-icon {
    font-size: 20px;
    line-height: 1;
}

.mode-name {
    font-size: 13px;
    font-weight: 600;
    color: rgb(25, 25, 24);
}

.mode-desc {
    font-size: 11px;
    color: rgba(25, 25, 24, 0.5);
    line-height: 1.3;
}

.mode-btn.active .mode-name {
    color: #2383E2;
}

.button-row {
    display: flex;
    justify-content: flex-end;
}

/* Primary Button */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 16px;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 50px;
    background: #000000;
    color: white;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease;
    white-space: nowrap;
}

.btn-primary:hover:not(:disabled) {
    background: #1a1a1a;
}

.btn-primary:active:not(:disabled) {
    background: #333333;
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary svg {
    width: 18px;
    height: 18px;
}

/* Loading State */
.loading-state {
    text-align: center;
    padding: 48px 24px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-top: 24px;
}

.spinner-container {
    margin-bottom: 24px;
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto;
    border: 3px solid rgba(35, 131, 226, 0.2);
    border-top-color: #2383E2;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 18px;
    font-weight: 500;
    color: rgb(25, 25, 24);
}

/* Error State */
.error-state {
    text-align: center;
    padding: 32px 24px;
    background: #fef2f2;
    border: 0.5px solid #fecaca;
    border-radius: 12px;
    margin-top: 24px;
}

.error-icon {
    color: #dc2626;
    margin-bottom: 12px;
}

.error-icon svg {
    width: 40px;
    height: 40px;
}

.error-text {
    font-size: 16px;
    color: #991b1b;
    margin-bottom: 16px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    padding: 10px 16px;
    font-size: 16px;
    font-weight: 500;
    color: #2383E2;
    background: white;
    border: 0.5px solid #2383E2;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-outline:hover {
    background: rgba(35, 131, 226, 0.08);
}

/* Result Section */
.result-section {
    animation: fadeInUp 0.4s ease;
}

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

/* Result Mode Badge */
.result-mode {
    text-align: center;
    margin-bottom: 16px;
}

.mode-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 6px 12px;
    background: rgba(35, 131, 226, 0.1);
    color: #2383E2;
    border-radius: 20px;
}

/* Clarified Card */
.clarified-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 16px;
}

.clarified-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.clarified-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(25, 25, 24, 0.5);
}

.copy-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: rgba(25, 25, 24, 0.6);
    background: transparent;
    border: 0.5px solid rgba(55, 53, 47, 0.16);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-btn:hover {
    background: rgba(55, 53, 47, 0.08);
    color: rgb(25, 25, 24);
}

.copy-btn.copied {
    background: rgba(34, 197, 94, 0.12);
    border-color: rgba(34, 197, 94, 0.3);
    color: #16a34a;
}

.copy-btn svg {
    width: 14px;
    height: 14px;
}

.clarified-text {
    font-size: 20px;
    font-weight: 400;
    line-height: 1.6;
    color: rgb(25, 25, 24);
}

/* Analysis Card */
.analysis-card {
    background: rgba(55, 53, 47, 0.04);
    border-radius: 8px;
    margin-bottom: 24px;
}

.analysis-details {
    cursor: pointer;
}

.analysis-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
    color: rgba(25, 25, 24, 0.6);
    list-style: none;
    user-select: none;
}

.analysis-summary::-webkit-details-marker {
    display: none;
}

.analysis-summary svg {
    width: 16px;
    height: 16px;
}

.analysis-summary:hover {
    color: rgb(25, 25, 24);
}

.analysis-content {
    padding: 0 16px 16px;
}

.analysis-content p {
    font-size: 14px;
    line-height: 1.5;
    color: rgba(25, 25, 24, 0.7);
    margin-bottom: 8px;
}

.analysis-content p:last-child {
    margin-bottom: 0;
}

.analysis-content strong {
    color: rgb(25, 25, 24);
    font-weight: 500;
}

/* Result Actions */
.result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 16px;
    font-weight: 500;
    color: rgba(25, 25, 24, 0.8);
    background: white;
    border: 0.5px solid rgba(55, 53, 47, 0.16);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: rgba(55, 53, 47, 0.08);
    border-color: rgba(55, 53, 47, 0.24);
}

.btn-secondary svg {
    width: 18px;
    height: 18px;
}

.btn-secondary.primary {
    background: #2383E2;
    border-color: #2383E2;
    color: white;
}

.btn-secondary.primary:hover {
    background: #1B6DC1;
    border-color: #1B6DC1;
}

/* Examples Section */
.examples-section {
    margin-top: 48px;
    text-align: center;
}

.examples-title {
    font-size: 14px;
    font-weight: 500;
    color: rgba(25, 25, 24, 0.5);
    margin-bottom: 16px;
}

.examples-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.example-btn {
    padding: 8px 14px;
    font-size: 14px;
    font-weight: 400;
    color: rgba(25, 25, 24, 0.7);
    background: white;
    border: 0.5px solid rgba(55, 53, 47, 0.12);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.example-btn:hover {
    background: rgba(35, 131, 226, 0.08);
    border-color: rgba(35, 131, 226, 0.3);
    color: #2383E2;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 24px 16px;
    }
    
    .input-card {
        padding: 24px;
    }
    
    textarea {
        font-size: 16px;
    }
    
    .mode-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .mode-btn {
        padding: 10px 6px;
    }
    
    .mode-desc {
        display: none;
    }
    
    .clarified-card {
        padding: 20px;
    }
    
    .clarified-text {
        font-size: 18px;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .mode-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .examples-grid {
        flex-direction: column;
    }
    
    .example-btn {
        width: 100%;
    }
}
