/**
 * PRAGMATICS SCAFFOLD COMPONENT STYLES
 *
 * Research-grade structured pragmatic analysis card
 * Used in: Jokes, Examples, Activities, Reflection
 */

/* ========================================
   SCAFFOLD CARD CONTAINER
   ======================================== */

.pragmatics-scaffold-card {
    background: linear-gradient(135deg, #f8f9ff 0%, #fff 100%);
    border: 2px solid #e0e7ff;
    border-radius: 16px;
    padding: 0;
    margin: 24px 0;
    box-shadow: 0 4px 6px rgba(99, 102, 241, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
}

.pragmatics-scaffold-card:hover {
    box-shadow: 0 8px 16px rgba(99, 102, 241, 0.15);
    border-color: #c7d2fe;
}

/* Hidden state */
.pragmatics-scaffold-card.scaffold-hidden {
    display: none;
}

/* Expanded state */
.pragmatics-scaffold-card.expanded .scaffold-content {
    max-height: none;
    opacity: 1;
}

.pragmatics-scaffold-card:not(.expanded) .scaffold-content {
    max-height: 0;
    opacity: 0;
    padding: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease, padding 0.3s ease;
}

/* ========================================
   TOGGLE BUTTON
   ======================================== */

.scaffold-toggle {
    width: 100%;
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border: none;
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: all 0.2s ease;
}

.scaffold-toggle:hover {
    background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
}

.scaffold-toggle:active {
    transform: scale(0.98);
}

.toggle-icon {
    font-size: 14px;
    transition: transform 0.3s ease;
}

.scaffold-toggle[aria-expanded="true"] .toggle-icon {
    transform: rotate(0deg);
}

.scaffold-toggle[aria-expanded="false"] .toggle-icon {
    transform: rotate(-90deg);
}

/* ========================================
   SCAFFOLD CONTENT
   ======================================== */

.scaffold-content {
    padding: 24px;
    transition: all 0.3s ease;
}

.scaffold-header {
    text-align: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e0e7ff;
}

.scaffold-header h4 {
    margin: 0 0 8px 0;
    font-size: 24px;
    color: #4338ca;
    font-weight: 700;
}

.scaffold-description {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
    font-style: italic;
}

/* ========================================
   SCAFFOLD GRID
   ======================================== */

.scaffold-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

@media (max-width: 768px) {
    .scaffold-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   SCAFFOLD ITEMS
   ======================================== */

.scaffold-item {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-left: 4px solid #e5e7eb;
    transition: all 0.2s ease;
}

.scaffold-item:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Item-specific colors */
.scaffold-target {
    border-left-color: #f59e0b;
    background: linear-gradient(135deg, #fffbeb 0%, #fff 100%);
}

.scaffold-trigger {
    border-left-color: #3b82f6;
    background: linear-gradient(135deg, #eff6ff 0%, #fff 100%);
}

.scaffold-inference {
    border-left-color: #8b5cf6;
    background: linear-gradient(135deg, #f5f3ff 0%, #fff 100%);
}

.scaffold-social {
    border-left-color: #ec4899;
    background: linear-gradient(135deg, #fdf2f8 0%, #fff 100%);
}

.scaffold-appropriacy {
    border-left-color: #10b981;
    background: linear-gradient(135deg, #ecfdf5 0%, #fff 100%);
}

.scaffold-repair {
    border-left-color: #6366f1;
    background: linear-gradient(135deg, #eef2ff 0%, #fff 100%);
}

/* ========================================
   SCAFFOLD ITEM HEADER
   ======================================== */

.scaffold-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #e5e7eb;
}

.scaffold-icon {
    font-size: 24px;
    line-height: 1;
}

.scaffold-item-header h5 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #1f2937;
}

/* ========================================
   SCAFFOLD ITEM CONTENT
   ======================================== */

.scaffold-item-content {
    color: #374151;
    line-height: 1.6;
}

.scaffold-label {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.scaffold-value {
    font-size: 15px;
    color: #1f2937;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.scaffold-value em {
    color: #9ca3af;
    font-style: italic;
}

/* Highlighted inference */
.highlight-inference {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    border-color: #d8b4fe;
    font-weight: 500;
    font-style: italic;
}

/* Repair option styling */
.repair-value {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border-color: #c7d2fe;
    font-weight: 600;
    color: #4338ca;
    font-family: 'Courier New', monospace;
}

/* ========================================
   SOCIAL VARIABLES
   ======================================== */

.social-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.social-var {
    padding: 12px;
    background: #fdf2f8;
    border-radius: 8px;
    border-left: 3px solid #ec4899;
}

.social-var strong {
    display: block;
    color: #9f1239;
    font-size: 14px;
    margin-bottom: 4px;
}

.social-var span {
    color: #374151;
    font-size: 14px;
}

.social-var span em {
    color: #9ca3af;
    font-style: italic;
}

/* ========================================
   APPROPRIACY SECTIONS
   ======================================== */

.appropriacy-section {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
}

.appropriacy-section:last-child {
    margin-bottom: 0;
}

.appropriacy-section strong {
    display: block;
    margin-bottom: 6px;
    font-size: 14px;
}

.appropriacy-section p {
    margin: 0;
    font-size: 14px;
    color: #374151;
}

.appropriacy-section.works {
    background: #d1fae5;
    border-left: 3px solid #10b981;
}

.appropriacy-section.works strong {
    color: #065f46;
}

.appropriacy-section.fails {
    background: #fee2e2;
    border-left: 3px solid #ef4444;
}

.appropriacy-section.fails strong {
    color: #991b1b;
}

/* ========================================
   RESEARCH NOTE
   ======================================== */

.scaffold-research-note {
    margin-top: 24px;
    padding: 16px;
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border-radius: 12px;
    border: 1px solid #bbf7d0;
}

.scaffold-research-note details {
    cursor: pointer;
}

.scaffold-research-note summary {
    font-weight: 700;
    color: #15803d;
    font-size: 15px;
    padding: 8px;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.scaffold-research-note summary::-webkit-details-marker {
    display: none;
}

.scaffold-research-note summary::before {
    content: '▶';
    font-size: 12px;
    transition: transform 0.2s ease;
}

.scaffold-research-note details[open] summary::before {
    transform: rotate(90deg);
}

.research-content {
    padding: 12px 8px 8px 8px;
    color: #166534;
}

.research-content p {
    margin: 0 0 12px 0;
    font-size: 14px;
}

.research-content ul {
    margin: 0;
    padding-left: 24px;
}

.research-content li {
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 1.5;
}

.research-content strong {
    color: #14532d;
}

/* ========================================
   TEACHER CONTROLS
   ======================================== */

.teacher-controls {
    display: none; /* Hidden by default, shown when teacherMode enabled */
    margin: 16px 0;
    padding: 12px;
    background: #fef3c7;
    border-radius: 8px;
    border-left: 4px solid #f59e0b;
}

.teacher-controls button {
    background: #f59e0b;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    margin-right: 8px;
}

.teacher-controls button:hover {
    background: #d97706;
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .pragmatics-scaffold-card {
        page-break-inside: avoid;
        box-shadow: none;
        border: 2px solid #000;
    }

    .scaffold-toggle {
        display: none;
    }

    .scaffold-content {
        max-height: none !important;
        opacity: 1 !important;
        padding: 24px !important;
    }

    .scaffold-grid {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */

.scaffold-toggle:focus {
    outline: 3px solid #fbbf24;
    outline-offset: 2px;
}

.scaffold-item:focus-within {
    outline: 2px solid #6366f1;
    outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .pragmatics-scaffold-card,
    .scaffold-toggle,
    .scaffold-item,
    .toggle-icon {
        transition: none;
    }
}
