/* Stack Trace Interface */
.stack-trace-interface {
    margin-bottom: 2rem;
}

/* Controls */
.trace-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    color: #374151;
}

.label-icon {
    font-size: 1rem;
}

.control-select {
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    font-size: 0.9375rem;
    color: #1f2937;
    cursor: pointer;
    transition: all 0.2s ease;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23374151' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

.control-select:hover {
    border-color: #9ca3af;
}

.control-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Trace Card */
.trace-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.trace-card-body {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

@media (min-width: 992px) {
    .trace-card-body {
        grid-template-columns: 1fr 1fr;
    }
    
    .input-section {
        border-right: 1px solid #e5e7eb;
    }
    
    .input-section .section-header {
        border-right: 1px solid rgba(255, 255, 255, 0.1);
    }
}

/* Input/Output Sections */
.input-section,
.output-section {
    display: flex;
    flex-direction: column;
    min-height: 400px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
}

.section-icon {
    font-size: 1.25rem;
}

.section-actions {
    display: flex;
    gap: 0.5rem;
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.icon-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.icon-btn:active {
    transform: translateY(0);
}

/* Input Wrapper */
.input-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
}

.trace-input {
    flex: 1;
    width: 100%;
    border: none;
    outline: none;
    resize: none;
    
    font-size: 0.875rem;
    line-height: 1.6;
    color: #1f2937;
    background: #f9fafb;
    padding: 1rem;
    border-radius: 8px;
    min-height: 300px;
}

.trace-input:focus {
    background: white;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.trace-input::placeholder {
    color: #9ca3af;
}

.input-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
}

.char-count {
    font-size: 0.75rem;
    color: #6b7280;
    font-weight: 500;
}

/* Output Wrapper */
.output-wrapper {
    flex: 1;
    padding: 1.25rem;
    overflow: auto;
    background: #f9fafb;
}

.trace-output {
    min-height: 300px;
    
    font-size: 0.875rem;
    line-height: 1.6;
}

.output-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    color: #9ca3af;
    text-align: center;
    padding: 2rem;
}

.placeholder-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.placeholder-text {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #6b7280;
}

.placeholder-hint {
    font-size: 0.875rem;
    color: #9ca3af;
    margin: 0;
}

/* Stack Frame Styles */
.stack-error {
    padding: 1rem;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-left: 4px solid #ef4444;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.1);
}

.stack-error-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1rem;
    color: #991b1b;
    margin-bottom: 0.5rem;
}

.stack-error-message {
    color: #7f1d1d;
    font-size: 0.9375rem;
    line-height: 1.5;
}

.stack-frames {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.stack-frame {
    padding: 1rem;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.stack-frame:hover {
    border-color: #6366f1;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
    transform: translateY(-2px);
}

.stack-frame-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.stack-frame-function {
    font-weight: 700;
    font-size: 0.9375rem;
    color: #6366f1;
    word-break: break-word;
}

.stack-frame-index {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.stack-frame-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stack-frame-location {
    font-size: 0.8125rem;
    color: #6b7280;
    font-weight: 500;
}

.stack-frame-path {
    font-size: 0.75rem;
    color: #9ca3af;
    
    word-break: break-all;
    padding: 0.5rem;
    background: #f3f4f6;
    border-radius: 4px;
    margin-top: 0.25rem;
}

/* Compact Mode */
.stack-frame-compact {
    padding: 0.75rem;
    background: white;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: background 0.2s ease;
}

.stack-frame-compact:hover {
    background: #f9fafb;
}

.stack-frame-compact .stack-frame-index {
    min-width: 24px;
    height: 24px;
    font-size: 0.6875rem;
}

.stack-frame-compact .stack-frame-function {
    flex: 1;
    font-size: 0.875rem;
}

.stack-frame-compact .stack-frame-location {
    font-size: 0.75rem;
}

/* Detailed Mode */
.stack-frame-detailed {
    padding: 1.25rem;
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.stack-frame-detailed-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 768px) {
    .stack-frame-detailed-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.stack-frame-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stack-frame-field-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stack-frame-field-value {
    font-size: 0.9375rem;
    color: #1f2937;
    font-weight: 500;
}

.stack-frame-field-value code {
    
    background: #f3f4f6;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
}

/* Analysis Panel */
.analysis-panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    margin-top: 1.5rem;
    animation: slideDown 0.3s ease;
}

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

.analysis-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.analysis-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 700;
    font-size: 1.125rem;
}

.analysis-icon {
    font-size: 1.5rem;
}

.analysis-content {
    padding: 1.5rem;
}

.analysis-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

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

.analysis-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.analysis-section-title {
    font-weight: 700;
    font-size: 1rem;
    color: #1f2937;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e5e7eb;
}

.analysis-stats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.analysis-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: #f9fafb;
    border-radius: 6px;
}

.analysis-stat-label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.analysis-stat-value {
    font-size: 0.9375rem;
    color: #1f2937;
    font-weight: 700;
}

.analysis-recommendations {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.analysis-recommendation {
    padding: 0.75rem 1rem;
    background: #eff6ff;
    border-left: 3px solid #3b82f6;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #1e40af;
    line-height: 1.5;
}

.analysis-suspicious {
    margin-top: 1rem;
    padding: 1rem;
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
}

.analysis-suspicious-title {
    font-weight: 700;
    font-size: 0.9375rem;
    color: #92400e;
    margin-bottom: 0.75rem;
}

.analysis-suspicious-item {
    padding: 0.5rem;
    background: white;
    border-radius: 4px;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: #78350f;
    
}

.analysis-suspicious-item:last-child {
    margin-bottom: 0;
}

/* Mobile Responsive */
@media (max-width: 767px) {
    .trace-controls {
        grid-template-columns: 1fr;
        padding: 1rem;
    }

    .trace-card {
        border-radius: 8px;
    }

    .trace-card-body {
        grid-template-columns: 1fr;
    }

    .input-section {
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
    }

    .section-header {
        padding: 0.875rem 1rem;
    }

    .section-title {
        font-size: 0.9375rem;
    }

    .input-wrapper,
    .output-wrapper {
        padding: 1rem;
    }

    .trace-input {
        min-height: 250px;
        font-size: 0.8125rem;
    }

    .trace-output {
        min-height: 250px;
        font-size: 0.8125rem;
    }

    .stack-frame {
        padding: 0.875rem;
    }

    .stack-frame-detailed {
        padding: 1rem;
    }

    .analysis-content {
        padding: 1rem;
    }

    .analysis-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
}

/* Loading State */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #6b7280;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 3px solid #e5e7eb;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-left: 0.5rem;
}

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

/* Copy Success Animation */
.copy-success {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 0.75rem 1.25rem;
    background: #10b981;
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    font-weight: 600;
    font-size: 0.875rem;
    z-index: 1000;
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}