/* Copyright (c) 2024-2026. Jericho Crosby (Chalwk) */

.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

@media (min-width: 992px) {
    .app-grid {
        grid-template-columns: 2fr 1fr;
    }
}

.scripts-library,
.premade-scripts {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 0.5rem;
}

.script-card {
    padding: 1rem;
    border-radius: var(--radius);
    background: var(--light);
    border: 1px solid var(--gray-light);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.script-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.script-card h4 {
    margin: 0 0 0.5rem;
    color: var(--dark);
    font-size: 1rem;
}

.script-card p {
    margin: 0;
    color: var(--gray);
    font-size: 0.875rem;
}

.script-card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.premade-script-card {
    background: rgba(124, 58, 237, 0.05);
    border-color: rgba(124, 58, 237, 0.2);
}

.premade-script-card h4 {
    color: var(--secondary);
}

.steps-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
    padding: 0.5rem;
    margin-bottom: 1rem;
}

.step-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem;
    border-radius: var(--radius);
    background: var(--light);
    border: 1px solid var(--gray-light);
    animation: fadeIn 0.3s ease;
}

.step-content {
    flex: 1;
}

.step-item textarea {
    width: 100%;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--gray-light);
    font-size: 0.9rem;
    resize: vertical;
    min-height: 60px;
    font-family: var(--font-primary), sans-serif;
    background: white;
}

.step-item textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.step-type {
    min-width: 140px;
}

.step-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.step-type-statement {
    background: #dbeafe;
    color: #1e40af;
}

.step-type-question {
    background: #f0fdf4;
    color: #166534;
}

.step-type-action {
    background: #fef3c7;
    color: #92400e;
}

.step-type-reminder {
    background: #f3e8ff;
    color: #7c3aed;
}

.step-type-transition {
    background: #e0f2fe;
    color: #0369a1;
}

.step-type-observation {
    background: #f0f9ff;
    color: #0c4a6e;
}

.step-type-validation {
    background: #f0fdfa;
    color: #0f766e;
}

.step-type-boundary {
    background: #fef2f2;
    color: #991b1b;
}

.step-type-followup {
    background: #faf5ff;
    color: #7c3aed;
}

.step-type-closure {
    background: #fffbeb;
    color: #92400e;
}

.preview-modal {
    border: none;
    border-radius: var(--radius-lg);
    padding: 0;
    max-width: 600px;
    width: 90vw;
    box-shadow: var(--shadow-lg);
}

.preview-content {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.preview-steps {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.preview-step {
    padding: 1rem;
    border-radius: var(--radius);
    border-left: 4px solid;
    background: var(--light);
}

.preview-step-type {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.preview-step-text {
    font-size: 0.95rem;
    line-height: 1.4;
}

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

.fade-in {
    animation: fadeIn 0.3s ease both;
}

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

    .step-item {
        flex-direction: column;
        gap: 0.75rem;
    }

    .step-type {
        min-width: 100%;
    }

    .scripts-library,
    .premade-scripts {
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    .script-card-actions {
        flex-wrap: wrap;
    }

    .step-actions {
        flex-wrap: wrap;
    }

    .script-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .script-actions .btn {
        width: 100%;
    }
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.field span {
    font-weight: 500;
    color: var(--dark);
    font-size: 0.9rem;
}

.field input,
.field textarea {
    padding: 0.75rem;
    border-radius: var(--radius);
    border: 1px solid var(--gray-light);
    font-size: 0.95rem;
    background: white;
    font-family: var(--font-primary), sans-serif;
}

.field input:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.skip {
    position: absolute;
    left: -999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.skip:focus {
    left: 1rem;
    top: 1rem;
    width: auto;
    height: auto;
    padding: 0.5rem 1rem;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    z-index: 1001;
}

.panel-style {
    background: var(--light);
    border: 1px solid var(--gray-light);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.step-actions-container {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    align-items: center;
}

.script-actions-container {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.search-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--gray-light);
    border-radius: var(--radius);
}

.premade-scripts-section {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid var(--gray-light);
}

.practice-tools-section {
    margin-top: 2rem;
}

.tool-option-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.checkbox-input {
    width: 1.25rem;
    height: 1.25rem;
}

.modal-base {
    border: none;
    border-radius: var(--radius-lg);
    padding: 0;
    width: 90vw;
    box-shadow: var(--shadow-lg);
}

.practice-modal {
    max-width: 500px;
}

.help-modal {
    max-width: 600px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-light);
}

.practice-content {
    padding: 1.5rem;
}

.practice-step {
    text-align: center;
    padding: 2rem;
    border-radius: var(--radius);
    background: var(--light);
    margin-bottom: 1.5rem;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.step-content {
    font-size: 1.1rem;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.step-type-badge {
    padding: 0.25rem 1rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
}

.practice-progress {
    margin: 1.5rem 0;
}

.progress-bar {
    height: 6px;
    background: var(--gray-light);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s;
    width: 0;
}

.practice-controls {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.practice-timer {
    display: none;
    text-align: center;
    margin-top: 1rem;
    padding: 0.75rem;
    background: var(--light);
    border-radius: var(--radius);
    font-weight: 600;
}

.help-content {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.help-section {
    margin-bottom: 1.5rem;
}

.help-section h4 {
    margin: 0 0 0.5rem;
    color: var(--dark);
}

.help-section ul {
    padding-left: 1.5rem;
    color: var(--dark);
}

.modal-actions {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-light);
    display: flex;
    justify-content: flex-end;
}

.empty-library {
    color: var(--gray);
    text-align: center;
    padding: 2rem;
}

.panel-head h2 {
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.panel-head .small {
    color: var(--gray);
}

.script-steps h3 {
    color: var(--dark);
    margin-bottom: 1rem;
}

.premade-scripts-section h3 {
    color: var(--dark);
    margin-bottom: 0.5rem;
}

.premade-scripts-section .small {
    color: var(--gray);
    margin-bottom: 1rem;
}

.practice-tools h3 {
    color: var(--dark);
    margin-bottom: 1rem;
}