/* ===== Anger Type Diagnosis - Frontend Styles ===== */
/* SWELL compatible: uses minimal specificity, no !important */

.atd-app {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 16px;
    font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
}

/* ----- Loading ----- */
.atd-loading, .atd-calculating {
    text-align: center;
    padding: 60px 20px;
}

.atd-spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 16px;
    border: 4px solid #e5e7eb;
    border-top-color: #D94032;
    border-radius: 50%;
    animation: atd-spin 0.8s linear infinite;
}

.atd-spinner-large {
    width: 56px;
    height: 56px;
    border-width: 5px;
}

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

/* ----- Intro ----- */
.atd-intro {
    text-align: center;
    padding: 40px 20px;
}

.atd-intro-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.atd-intro-title {
    font-size: 24px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 12px;
}

.atd-intro-desc {
    font-size: 15px;
    color: #6b7280;
    line-height: 1.7;
    margin-bottom: 24px;
}

.atd-intro-meta {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 32px;
    font-size: 14px;
    color: #9ca3af;
}

/* ----- Buttons ----- */
.atd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 32px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.atd-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.atd-btn-primary {
    background: #D94032;
    color: #fff;
}

.atd-btn-primary:hover:not(:disabled) {
    background: #c0392b;
    transform: translateY(-1px);
}

.atd-btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.atd-btn-secondary:hover:not(:disabled) {
    background: #e5e7eb;
}

.atd-btn-start {
    padding: 16px 48px;
    font-size: 18px;
    border-radius: 12px;
}

/* ----- Progress ----- */
.atd-progress {
    position: relative;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    margin-bottom: 32px;
    overflow: visible;
}

.atd-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #D94032, #F5A623);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.atd-progress-text {
    position: absolute;
    right: 0;
    top: -24px;
    font-size: 13px;
    color: #9ca3af;
    font-weight: 500;
}

/* ----- Question ----- */
.atd-question-container {
    padding: 20px 0;
}

.atd-question-card {
    background: #fff;
    border-radius: 12px;
    padding: 28px 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.atd-question-number {
    font-size: 13px;
    font-weight: 700;
    color: #D94032;
    margin: 0 0 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.atd-question-text {
    font-size: 17px;
    font-weight: 500;
    color: #1f2937;
    line-height: 1.7;
    margin: 0;
}

/* ----- Options ----- */
.atd-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 28px;
}

.atd-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.atd-option:hover {
    border-color: #D94032;
    background: #fef2f2;
}

.atd-option-selected {
    border-color: #D94032;
    background: #fef2f2;
}

.atd-option-selected .atd-option-num {
    background: #D94032;
    color: #fff;
}

.atd-option-num {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #f3f4f6;
    color: #6b7280;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    transition: all 0.2s;
}

.atd-option-label {
    font-size: 15px;
    color: #374151;
}

/* ----- Navigation ----- */
.atd-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.atd-btn-back {
    background: transparent;
    color: #9ca3af;
    padding: 10px 20px;
}

.atd-btn-back:hover:not(:disabled) {
    color: #6b7280;
}

.atd-btn-next {
    background: #D94032;
    color: #fff;
    padding: 12px 28px;
    margin-left: auto;
}

.atd-btn-next:hover:not(:disabled) {
    background: #c0392b;
}

/* ----- Calculating Animation ----- */
.atd-calc-text {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 20px;
}

.atd-calc-steps {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.atd-calc-step {
    padding: 6px 14px;
    border-radius: 20px;
    background: #f3f4f6;
    color: #9ca3af;
    font-size: 13px;
    transition: all 0.3s;
}

.atd-calc-active {
    background: #D94032;
    color: #fff;
}

/* ----- Result ----- */
.atd-result {
    padding: 20px 0 40px;
}

.atd-result-header {
    text-align: center;
    padding: 32px 24px;
    background: #fff;
    border-radius: 16px;
    border-top: 5px solid;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 24px;
}

.atd-result-subtitle {
    font-size: 14px;
    color: #9ca3af;
    margin: 0 0 8px;
}

.atd-result-type-name {
    font-size: 32px;
    font-weight: 800;
    margin: 0 0 8px;
}

.atd-result-catchcopy {
    font-size: 15px;
    color: #6b7280;
    line-height: 1.6;
    margin: 0;
}

/* Result sections */
.atd-result-section {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.atd-result-section h3 {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 12px;
}

.atd-result-section p {
    font-size: 15px;
    color: #4b5563;
    line-height: 1.7;
    margin: 0;
}

/* Columns */
.atd-result-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.atd-result-col {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.atd-result-col h3 {
    font-size: 15px;
    margin: 0 0 10px;
}

.atd-result-col p {
    font-size: 14px;
    color: #4b5563;
    line-height: 1.6;
    margin: 0;
}

/* Compatibility */
.atd-result-compatibility {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.atd-compat-good, .atd-compat-bad {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.atd-compat-good h3, .atd-compat-bad h3 {
    font-size: 14px;
    margin: 0 0 8px;
}

.atd-compat-name {
    font-size: 16px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 6px;
}

.atd-compat-reason {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.6;
    margin: 0;
}

/* Score bars */
.atd-result-scores {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.atd-result-scores h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 16px;
}

.atd-scores-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.atd-scores-grid h4 {
    font-size: 13px;
    color: #9ca3af;
    margin: 0 0 12px;
    font-weight: 600;
}

.atd-score-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.atd-score-label {
    font-size: 13px;
    color: #6b7280;
    width: 48px;
    flex-shrink: 0;
}

.atd-score-bar-bg {
    flex: 1;
    height: 8px;
    background: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
}

.atd-score-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s ease;
}

.atd-score-value {
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    width: 24px;
    text-align: right;
}

.atd-score-active .atd-score-label {
    color: #1f2937;
    font-weight: 700;
}

/* Share */
.atd-share {
    text-align: center;
    margin-bottom: 24px;
}

.atd-share h3 {
    font-size: 16px;
    margin-bottom: 16px;
}

.atd-share-buttons {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.atd-share-btn {
    display: inline-flex;
    align-items: center;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    color: #fff;
    transition: opacity 0.2s;
}

.atd-share-btn:hover {
    opacity: 0.85;
    color: #fff;
    text-decoration: none;
}

.atd-share-twitter { background: #1da1f2; }
.atd-share-line { background: #06c755; }
.atd-share-facebook { background: #1877f2; }

/* Retry */
.atd-retry {
    text-align: center;
}

.atd-btn-retry-link {
    display: inline-flex;
    text-decoration: none;
}

.atd-btn-retry-link:hover {
    text-decoration: none;
}

/* Type List Grid */
.atd-type-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding: 20px 0;
}

.atd-type-card {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: transform 0.2s;
}

.atd-type-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.atd-type-card:hover .atd-type-name {
    color: #D94032;
}

.atd-type-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}

.atd-type-name {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 6px;
}

.atd-type-catch {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
    margin: 0;
}

/* Error */
.atd-error {
    text-align: center;
    padding: 40px;
    color: #D94032;
}

/* ----- Type Individual Pages ----- */
.atd-type-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 16px 60px;
}

.atd-type-page-header {
    text-align: center;
    padding: 40px 24px;
    background: #fff;
    border-radius: 16px;
    border-top: 5px solid;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin-bottom: 28px;
}

.atd-type-page-icon {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    margin-bottom: 12px;
}

.atd-type-page-axes {
    font-size: 14px;
    color: #9ca3af;
    margin: 0 0 8px;
}

.atd-type-page-name {
    font-size: 32px;
    font-weight: 800;
    margin: 0 0 10px;
}

.atd-type-page-catch {
    font-size: 16px;
    color: #6b7280;
    line-height: 1.6;
    margin: 0;
}

.atd-type-page-section {
    background: #fff;
    border-radius: 12px;
    padding: 28px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.atd-type-page-section h2 {
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 14px;
}

.atd-type-page-section p {
    font-size: 15px;
    color: #4b5563;
    line-height: 1.8;
    margin: 0;
}

.atd-type-page-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.atd-type-page-box {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.atd-type-page-box h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 10px;
}

.atd-type-page-box p {
    font-size: 14px;
    color: #4b5563;
    line-height: 1.7;
    margin: 0;
}

.atd-type-page-compat-name {
    font-size: 17px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 8px;
}

.atd-type-page-cta {
    text-align: center;
    background: linear-gradient(135deg, #fef2f2, #fff5f5);
    border-radius: 16px;
    padding: 40px 24px;
    margin-bottom: 28px;
}

.atd-type-page-cta h2 {
    font-size: 20px;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 8px;
}

.atd-type-page-cta p {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 20px;
}

.atd-type-card-current {
    background: #fef2f2;
    border-width: 3px;
}

/* ----- Mobile responsive ----- */
@media (max-width: 600px) {
    .atd-result-columns,
    .atd-result-compatibility,
    .atd-scores-grid,
    .atd-type-page-grid {
        grid-template-columns: 1fr;
    }

    .atd-result-type-name,
    .atd-type-page-name {
        font-size: 26px;
    }

    .atd-intro-meta {
        flex-direction: column;
        gap: 8px;
    }
}
