/**
 * Supreme Court Interpretation Demo Widget Styles
 * Standalone widget version for embedding
 */

:root {
    --scotus-primary: #008BFF;
    --scotus-primary-dark: #0070CC;
    --scotus-text: #32373c;
    --scotus-text-light: #666;
    --scotus-background: #ebebeb;
    --scotus-border: #eaeaea;
    --scotus-white: #ffffff;
    --scotus-accent: #8b5cf6;
    --scotus-early: #F32B44;
    --scotus-middle: #f59e0b;
    --scotus-modern: #10b981;
}

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

body {
    font-family: Arial, -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--scotus-text);
    background: #F32B44;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
}

.scotus-widget {
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

.scotus-demo {
    background: transparent;
    padding: 0;
}

.demo-header {
    text-align: center;
    margin-bottom: 24px;
}

.demo-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #000000;
    margin-bottom: 8px;
}

.demo-subtitle {
    color: #000000;
    font-size: 0.95rem;
}

/* Clause Selector */
.clause-selector {
    margin-bottom: 0;
    display: flex;
    justify-content: flex-start;
    margin: 0 auto;
    max-width: 700px;
    width: 100%;
}

.clause-selector::before {
    content: "Choose Clause:";
    font-weight: 600;
    color: white;
    font-size: 0.85rem;
    background: linear-gradient(135deg, var(--scotus-primary) 0%, var(--scotus-primary-dark) 100%);
    padding: 8px 12px;
    border-radius: 4px 0 0 0;
    border: 1px solid var(--scotus-primary);
    border-right: none;
    display: flex;
    align-items: center;
}

.clause-selector select {
    padding: 8px 32px 8px 12px;
    font-size: 0.9rem;
    font-weight: 500;
    font-family: inherit;
    border: 1px solid #e8d4a8;
    border-radius: 0 4px 0 0;
    background-color: #f0ddb8;
    color: #2c1810;
    cursor: pointer;
    transition: all 0.15s ease;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232c1810' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    flex: 1;
}

.clause-selector select option {
    background-color: #f0ddb8;
    color: #2c1810;
}

/* Interpretation Container */
.interpretation-container {
    background: transparent;
    border-radius: 4px 4px 12px 12px;
    padding: 0 28px 28px 28px;
    margin-bottom: 20px;
}

.interpretation-container-inner {
    background: #ffffff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

/* Constitutional Text */
.constitutional-text {
    background: linear-gradient(135deg, #f5e6c8 0%, #e8d4a8 100%);
    color: #2c1810;
    padding: 28px 60px;
    margin: 0 auto 24px auto;
    max-width: 700px;
    text-align: center;
    border: none;
    border-radius: 0 0 0 0;
    position: relative;
    filter: drop-shadow(0 3px 6px rgba(0,0,0,0.15));
}

.constitutional-text::before,
.constitutional-text::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 28px;
    background: inherit;
}

.constitutional-text::before {
    left: 0;
    clip-path: polygon(
        100% 0%, 40% 3%, 100% 6%, 50% 9%, 100% 12%, 30% 15%, 100% 18%, 60% 21%, 100% 24%, 40% 27%, 100% 30%,
        50% 33%, 100% 36%, 35% 39%, 100% 42%, 55% 45%, 100% 48%, 40% 51%, 100% 54%, 60% 57%, 100% 60%,
        45% 63%, 100% 66%, 35% 69%, 100% 72%, 55% 75%, 100% 78%, 40% 81%, 100% 84%, 50% 87%, 100% 90%,
        35% 93%, 100% 96%, 45% 100%, 100% 100%
    );
}

.constitutional-text::after {
    right: 0;
    clip-path: polygon(
        0% 0%, 60% 3%, 0% 6%, 50% 9%, 0% 12%, 70% 15%, 0% 18%, 40% 21%, 0% 24%, 60% 27%, 0% 30%,
        50% 33%, 0% 36%, 65% 39%, 0% 42%, 45% 45%, 0% 48%, 60% 51%, 0% 54%, 40% 57%, 0% 60%,
        55% 63%, 0% 66%, 65% 69%, 0% 72%, 45% 75%, 0% 78%, 60% 81%, 0% 84%, 50% 87%, 0% 90%,
        65% 93%, 0% 96%, 55% 100%, 0% 100%
    );
}

.text-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #5c4a3a;
    margin-bottom: 12px;
}

.constitutional-text blockquote {
    font-size: 1.1rem;
    font-style: italic;
    line-height: 1.6;
    margin: 0 0 12px 0;
    color: #2c1810;
}

.text-source {
    font-size: 0.85rem;
    color: #6b5a4a;
}

.key-phrase-highlight {
    font-weight: 700;
    color: var(--scotus-primary);
}

/* Era Toggle */
.era-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    justify-content: center;
}

.era-btn {
    padding: 10px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: inherit;
    background: transparent;
    color: var(--scotus-primary);
    border: 2px solid var(--scotus-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    flex: 0 1 auto;
    min-width: 120px;
}

.era-btn:hover {
    background: rgba(0, 139, 255, 0.1);
}

.era-btn.active[data-era="early"] {
    background: var(--scotus-early);
    color: white;
    border-color: var(--scotus-early);
}

.era-btn.active[data-era="middle"] {
    background: var(--scotus-middle);
    color: white;
    border-color: var(--scotus-middle);
}

.era-btn.active[data-era="modern"] {
    background: var(--scotus-modern);
    color: white;
    border-color: var(--scotus-modern);
}

/* Interpretation Display */
.interpretation-display {
    animation: fadeIn 0.3s ease-out;
}

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

/* Key Phrase */
.key-phrase {
    background: var(--scotus-background);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 2px solid var(--scotus-primary);
    transition: background-color 0.3s ease, border-color 0.3s ease;
    text-align: left;
}

.key-phrase.era-early {
    background: rgba(243, 43, 68, 0.1);
    border-color: var(--scotus-early);
}

.key-phrase.era-middle {
    background: rgba(245, 158, 11, 0.1);
    border-color: var(--scotus-middle);
}

.key-phrase.era-modern {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--scotus-modern);
}

.phrase-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--scotus-text-light);
    margin-bottom: 8px;
}

.phrase-highlight {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--scotus-primary);
    margin-bottom: 8px;
}

.phrase-meaning {
    color: var(--scotus-text);
    line-height: 1.6;
}

.phrase-meaning strong {
    color: var(--scotus-primary);
}

/* Landmark Case */
.landmark-case {
    background: var(--scotus-white);
    border: 1px solid var(--scotus-border);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: left;
}

.case-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--scotus-text-light);
    margin-bottom: 8px;
}

.case-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--scotus-text);
    margin-bottom: 12px;
}

.case-ruling {
    color: var(--scotus-text-light);
    line-height: 1.6;
    font-size: 0.95rem;
}

/* Practical Impact */
.practical-impact {
    background: linear-gradient(135deg, var(--scotus-primary) 0%, var(--scotus-primary-dark) 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    max-width: 700px;
    margin: 0 auto 20px auto;
}

.impact-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
    margin-bottom: 12px;
}

.impact-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.impact-content li {
    padding: 8px 0 8px 24px;
    position: relative;
    line-height: 1.5;
}

.impact-content li::before {
    content: "→";
    position: absolute;
    left: 0;
    opacity: 0.8;
}

/* Comparison Note */
.comparison-note {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 0 0 16px 0;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}

.note-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.note-text {
    color: white;
    font-size: 0.9rem;
    line-height: 1.6;
    font-style: italic;
}

/* Buttons */
.btn-secondary {
    display: block;
    width: 100%;
    padding: 14px 24px;
    font-size: 1rem;
    font-weight: 600;
    font-family: inherit;
    background: var(--scotus-white);
    color: var(--scotus-primary);
    border: 2px solid var(--scotus-primary);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--scotus-primary);
    color: white;
}

/* Responsive - Tablet */
@media (max-width: 600px) {
    body {
        padding: 12px;
    }

    .interpretation-container {
        padding: 20px;
    }

    .constitutional-text {
        padding: 20px 16px;
    }

    .constitutional-text blockquote {
        font-size: 1rem;
    }

    .era-toggle {
        flex-direction: column;
    }

    .era-btn {
        min-width: 100%;
    }

    .demo-header h2 {
        font-size: 1.25rem;
    }

    .phrase-highlight {
        font-size: 1.1rem;
    }

    .clause-selector {
        flex-direction: column;
    }

    .clause-selector::before {
        border-radius: 4px 4px 0 0;
        border-right: 1px solid var(--scotus-primary);
        border-bottom: none;
        text-align: center;
    }

    .clause-selector select {
        width: 100%;
        min-width: auto;
        border-radius: 0 0 4px 4px;
    }
}

/* iPhone 16 Pro optimization (430px and below) */
@media (max-width: 430px) {
    body {
        padding: 4px;
    }

    .scotus-widget {
        max-width: 100%;
        width: 100%;
    }

    .interpretation-container {
        padding: 4px;
        border-radius: 4px 4px 8px 8px;
    }

    .interpretation-container-inner {
        padding: 12px;
        margin-bottom: 12px;
    }

    /* Constitutional text - use full width */
    .constitutional-text {
        max-width: 100%;
        padding: 16px 40px;
        margin-bottom: 16px;
    }

    .constitutional-text::before,
    .constitutional-text::after {
        width: 20px;
    }

    .constitutional-text blockquote {
        font-size: 0.95rem;
        line-height: 1.5;
    }

    .text-label {
        font-size: 0.7rem;
        margin-bottom: 8px;
    }

    .text-source {
        font-size: 0.8rem;
    }

    /* Era buttons - keep in row, smaller */
    .era-toggle {
        flex-direction: row;
        gap: 4px;
        margin-bottom: 16px;
    }

    .era-btn {
        min-width: auto;
        flex: 1;
        padding: 8px 6px;
        font-size: 0.65rem;
        line-height: 1.3;
    }

    /* Key phrase section */
    .key-phrase {
        padding: 14px;
        margin-bottom: 14px;
    }

    .phrase-label {
        font-size: 0.7rem;
        margin-bottom: 6px;
    }

    .phrase-highlight {
        font-size: 1rem;
        margin-bottom: 6px;
    }

    .phrase-meaning {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    /* Landmark case */
    .landmark-case {
        padding: 14px;
        margin-bottom: 14px;
    }

    .case-label {
        font-size: 0.7rem;
        margin-bottom: 6px;
    }

    .case-name {
        font-size: 1rem;
        margin-bottom: 10px;
    }

    .case-ruling {
        font-size: 0.88rem;
        line-height: 1.5;
    }

    /* Practical impact - full width */
    .practical-impact {
        max-width: 100%;
        padding: 14px;
        margin-bottom: 12px;
    }

    .impact-label {
        font-size: 0.7rem;
        margin-bottom: 10px;
    }

    .impact-content li {
        padding: 6px 0 6px 20px;
        font-size: 0.88rem;
        line-height: 1.45;
    }

    .comparison-note {
        padding: 0 0 12px 0;
        margin-bottom: 12px;
        gap: 10px;
    }

    .note-icon {
        font-size: 1.2rem;
    }

    .note-text {
        font-size: 0.85rem;
        line-height: 1.5;
    }

    /* Clause selector */
    .clause-selector::before {
        font-size: 0.8rem;
        padding: 6px 10px;
    }

    .clause-selector select {
        padding: 6px 28px 6px 10px;
        font-size: 0.85rem;
    }
}
