/**
 * Stage Toolbox Modal
 * FEATURE-011: Comprehensive tool management modal
 * 
 * Light theme matching mockup v2 design
 */

/* Modal Overlay */
.toolbox-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.toolbox-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Modal Container */
.toolbox-modal {
    width: 90vw;
    height: 90vh;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toolbox-modal-overlay.active .toolbox-modal {
    transform: scale(1) translateY(0);
}

/* Modal Header */
.toolbox-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
}

.toolbox-modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1e;
    letter-spacing: -0.3px;
}

.toolbox-modal-title i {
    color: #10b981;
}

.toolbox-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: #9898a0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.2s ease;
}

.toolbox-modal-close:hover {
    background: #f0f2f5;
    color: #1a1a1e;
}

/* Modal Body */
.toolbox-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.toolbox-modal-body::-webkit-scrollbar {
    width: 6px;
}

.toolbox-modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.toolbox-modal-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

/* Accordion */
.toolbox-accordion {
    border-radius: 10px;
    background: #f8f9fb;
    border: 1px solid #e5e7eb;
    overflow: hidden;
    margin-bottom: 10px;
    transition: all 0.2s ease;
}

.toolbox-accordion:hover {
    border-color: #d1d5db;
}

.toolbox-accordion.expanded {
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Accordion Header */
.toolbox-accordion-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
}

.toolbox-accordion-header:hover {
    background: #f0f2f5;
}

.toolbox-accordion-icon {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

/* Stage-specific icon colors */
.toolbox-accordion[data-stage="ideation"] .toolbox-accordion-icon {
    background: rgba(245, 158, 11, 0.12);
    color: #f59e0b;
}

.toolbox-accordion[data-stage="requirement"] .toolbox-accordion-icon {
    background: rgba(59, 130, 246, 0.12);
    color: #3b82f6;
}

.toolbox-accordion[data-stage="implement"] .toolbox-accordion-icon {
    background: rgba(16, 185, 129, 0.12);
    color: #10b981;
}

.toolbox-accordion[data-stage="validation"] .toolbox-accordion-icon {
    background: rgba(139, 92, 246, 0.12);
    color: #8b5cf6;
}

.toolbox-accordion[data-stage="feedback"] .toolbox-accordion-icon {
    background: rgba(249, 115, 22, 0.12);
    color: #f97316;
}

.toolbox-accordion-info {
    flex: 1;
    min-width: 0;
}

.toolbox-accordion-title {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: -0.2px;
    margin-bottom: 2px;
    color: #1a1a1e;
}

.toolbox-accordion-subtitle {
    font-size: 13px;
    color: #9898a0;
}

.toolbox-accordion-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    background: #f5f6f8;
    color: #5c5c66;
    border: 1px solid #e5e7eb;
}

.toolbox-accordion-badge.active {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.25);
}

.toolbox-accordion-chevron {
    color: #9898a0;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.toolbox-accordion.expanded .toolbox-accordion-chevron {
    transform: rotate(180deg);
}

/* Accordion Content */
.toolbox-accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.toolbox-accordion.expanded .toolbox-accordion-content {
    max-height: 5000px;
}

.toolbox-accordion-body {
    padding: 0 20px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Phase Groups */
.toolbox-phase {
    background: #f5f6f8;
    border-radius: 6px;
    padding: 14px;
    border: 1px solid #e5e7eb;
}

.toolbox-phase-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #9898a0;
    margin-bottom: 10px;
}

.toolbox-phase-tools {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Tool Item */
.toolbox-tool {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: #ffffff;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.toolbox-tool:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.toolbox-tool-name {
    font-size: 13px;
    font-weight: 500;
    color: #1a1a1e;
    font-family: 'JetBrains Mono', monospace;
}

/* Toggle Switch */
.toolbox-toggle {
    position: relative;
    width: 42px;
    height: 24px;
    cursor: pointer;
    display: inline-block;
}

.toolbox-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toolbox-toggle-slider {
    position: absolute;
    inset: 0;
    background: #d1d5db;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.toolbox-toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    top: 3px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toolbox-toggle input:checked + .toolbox-toggle-slider {
    background: #10b981;
}

.toolbox-toggle input:checked + .toolbox-toggle-slider::before {
    transform: translateX(18px);
}

/* Empty State */
.toolbox-empty {
    padding: 20px;
    text-align: center;
    color: #9898a0;
    font-size: 12px;
    background: #ffffff;
    border-radius: 6px;
    border: 1px dashed #e5e7eb;
}

/* Placeholder Badge */
.toolbox-placeholder-badge {
    font-size: 10px;
    padding: 2px 6px;
    background: rgba(152, 152, 160, 0.15);
    color: #9898a0;
    border-radius: 4px;
    margin-left: 8px;
    font-weight: 500;
}

/* Top Bar Toolbox Button */
.top-bar-btn.toolbox-trigger {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.top-bar-btn.toolbox-trigger:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* ============================================================
   FEATURE-012: Design Themes Section
   ============================================================ */

/* Themes Section Container */
.toolbox-themes-section {
    background: #ffffff;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    padding: 16px;
    margin-bottom: 16px;
}

.toolbox-themes-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1e;
    margin-bottom: 14px;
}

.toolbox-themes-header i {
    color: #ec4899;
    font-size: 18px;
}

/* Themes Grid - 4 columns */
.toolbox-themes-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
}

.toolbox-themes-grid::-webkit-scrollbar {
    width: 4px;
}

.toolbox-themes-grid::-webkit-scrollbar-track {
    background: transparent;
}

.toolbox-themes-grid::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

/* Theme Card */
.toolbox-theme-card {
    background: #f8f9fb;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.toolbox-theme-card:hover {
    border-color: #d1d5db;
    background: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.toolbox-theme-card.selected {
    border-color: #ec4899;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(236, 72, 153, 0.15);
}

/* Color Swatches */
.theme-card-swatches {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
    height: 32px;
    border-radius: 6px;
    overflow: hidden;
}

.theme-swatch {
    flex: 1;
    min-width: 0;
}

/* Theme Card Info */
.theme-card-info {
    min-height: 40px;
}

.theme-card-name {
    font-size: 12px;
    font-weight: 600;
    color: #1a1a1e;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.theme-card-desc {
    font-size: 10px;
    color: #9898a0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Selected Checkmark */
.theme-card-check {
    position: absolute;
    top: 8px;
    right: 8px;
    color: #ec4899;
    font-size: 16px;
}

/* Loading & Empty States */
.toolbox-themes-loading,
.toolbox-themes-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 24px;
    color: #9898a0;
    font-size: 13px;
}

/* ============================================================
   Extra Instruction Textarea
   ============================================================ */

.toolbox-extra-instruction {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed #e5e7eb;
}

.toolbox-extra-instruction-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #9898a0;
    margin-bottom: 8px;
}

.toolbox-extra-instruction-input {
    width: 100%;
    min-height: 80px;
    max-height: 150px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    color: #1a1a1e;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.toolbox-extra-instruction-input:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.toolbox-extra-instruction-input::placeholder {
    color: #b0b0b8;
}

.toolbox-extra-instruction-counter {
    margin-top: 6px;
    font-size: 11px;
    color: #9898a0;
    text-align: right;
}

.toolbox-extra-instruction.over-limit .toolbox-extra-instruction-counter {
    color: #ef4444;
}

.toolbox-extra-instruction.over-limit .toolbox-extra-instruction-input {
    border-color: #ef4444;
}

.toolbox-extra-instruction.over-limit .word-count {
    font-weight: 600;
}
