body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    display: grid;
    grid-template-columns: 320px 1fr 240px;
    gap: 16px;
    padding: 16px;
    flex: 1;
    overflow: hidden;
    background: transparent;
}

.panel {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    border: 1px solid rgba(255,255,255,0.3);
}

.panel::-webkit-scrollbar {
    width: 6px;
}

.panel::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.panel::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.panel::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

h2 {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

h2::before {
    content: '';
    width: 4px;
    height: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

/* Left Panel */
.input-group {
    margin-bottom: 16px;
}

.file-input {
    display: none;
}

.file-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px dashed #38bdf8;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #0369a1;
    transition: all 0.3s ease;
}

.file-label:hover {
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border-color: #0284c7;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(56, 189, 248, 0.2);
}

.image-preview {
    margin-top: 0;
    border: 2px dashed #e2e8f0;
    min-height: 220px;
    max-height: 280px;
    border-radius: 10px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: all 0.3s ease;
}

.image-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

.description-section {
    margin-top: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

textarea {
    width: 100%;
    flex: 1;
    min-height: 120px;
    padding: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    resize: vertical;
    transition: all 0.3s ease;
    background: #f8fafc;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
};
    padding: 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    resize: none;
    font-size: 0.9rem;
    background-color: #fff;
    box-sizing: border-box; /* Ensure padding doesn't overflow */
}

/* Middle Panel */
.result-display {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #fff;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 20px;
}

.svg-container {
    flex: 1;
    border: none;
    background-image: 
        linear-gradient(45deg, #f8fafc 25%, transparent 25%), 
        linear-gradient(-45deg, #f8fafc 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #f8fafc 75%), 
        linear-gradient(-45deg, transparent 75%, #f8fafc 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    min-height: 300px;
    transition: all 0.3s ease;
}

.svg-container:hover {
    box-shadow: inset 0 0 20px rgba(102, 126, 234, 0.05);
}

.placeholder-text {
    color: #94a3b8;
    font-size: 0.95rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.placeholder-text::before {
    content: '🎨';
    font-size: 2rem;
    opacity: 0.5;
}

.vector-loading-card {
    width: min(100%, 340px);
    padding: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
}

.vector-loading-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12) 0%, rgba(236, 72, 153, 0.14) 100%);
    color: #6d28d9;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.vector-loading-visual {
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 2px 0 0;
}

.vector-loading-svg {
    width: min(100%, 280px);
    height: auto;
    overflow: visible;
}

.team-orbit-ring {
    fill: none;
    stroke: rgba(139, 92, 246, 0.18);
    stroke-width: 2;
    stroke-dasharray: 8 10;
    animation: teamSpin 16s linear infinite;
    transform-origin: 160px 110px;
}

.team-orbit-ring.secondary {
    stroke: rgba(236, 72, 153, 0.16);
    stroke-dasharray: 5 9;
    animation-direction: reverse;
    animation-duration: 12s;
}

.team-connection-lines path {
    fill: none;
    stroke: rgba(148, 163, 184, 0.75);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-dasharray: 9 9;
    animation: teamDashFlow 1.8s linear infinite;
}

.team-center-panel {
    animation: teamPanelFloat 3.6s ease-in-out infinite;
}

.team-member {
    transform-origin: center;
}

.team-member.member-a {
    animation: memberFloatA 2.6s ease-in-out infinite;
}

.team-member.member-b {
    animation: memberFloatB 3s ease-in-out infinite;
}

.team-member.member-c {
    animation: memberFloatC 2.8s ease-in-out infinite;
}

.team-pulse-node {
    transform-origin: center;
    animation: teamNodePulse 1.8s ease-in-out infinite;
}

.team-pulse-node.node-b {
    animation-delay: 0.3s;
}

.team-pulse-node.node-c {
    animation-delay: 0.6s;
}

.team-pulse-node.node-d {
    animation-delay: 0.9s;
}

.team-spark {
    transform-origin: center;
    animation: teamSparkle 2.1s ease-in-out infinite;
}

.team-spark.spark-b {
    animation-delay: 0.45s;
}

.team-spark.spark-c {
    animation-delay: 0.9s;
}

.vector-loading-tip {
    color: #94a3b8;
    font-size: 0.76rem;
    line-height: 1.5;
    max-width: 240px;
}

@keyframes teamSpin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes teamDashFlow {
    to {
        stroke-dashoffset: -18;
    }
}

@keyframes teamPanelFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-3px);
    }
}

@keyframes memberFloatA {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

@keyframes memberFloatB {
    0%, 100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(-2px, -4px);
    }
}

@keyframes memberFloatC {
    0%, 100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(2px, -4px);
    }
}

@keyframes teamNodePulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.75;
    }
    50% {
        transform: scale(1.35);
        opacity: 1;
    }
}

@keyframes teamSparkle {
    0%, 100% {
        transform: scale(0.7);
        opacity: 0.35;
    }
    50% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Right Panel */
.controls-stack {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

button {
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#btnRecognize {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
}

#btnProgressiveReplicate {
    background: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
    color: white;
}

#btnFullFlow {
    background: linear-gradient(135deg, #14b8a6 0%, #0d9488 100%);
    color: white;
}

#btnOptimize {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

#btnDownload {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

#btnExportVisio {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    color: white;
}

button.primary {
    background-color: #1a56db;
    color: white;
    border: 1px solid #1a56db;
}

button.primary:hover:not(:disabled) {
    background-color: #1548b5;
    border-color: #1548b5;
}

/* Optimization Section */
.optimization-section,
.template-section {
    margin-top: 20px;
    border-top: 2px solid #e2e8f0;
    padding-top: 16px;
}

.optimization-section h3,
.template-section h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 10px;
}

.optimization-section p,
.template-section p {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 8px;
.template-mode-btn {
    padding: 8px 12px;
    font-size: 0.85rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* Hot Prompts Section */
.hot-prompts-section {
    margin-bottom: 12px;
    padding: 12px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.hot-prompts-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #6366f1;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.hot-prompts-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.hot-prompt-tag {
    padding: 5px 10px;
    font-size: 0.75rem;
    background: white;
    border: 1px solid #c7d2fe;
    border-radius: 20px;
    color: #4f46e5;
    cursor: pointer;
    transition: all 0.2s ease;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.hot-prompt-tag:hover {
    background: #6366f1;
    color: white;
    border-color: #6366f1;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(99, 102, 241, 0.3);
}

.hot-prompt-tag .prompt-icon {
    margin-right: 4px;
}

/* Image Complexity Indicator */
.complexity-section {
    margin-bottom: 12px;
    padding: 12px;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 8px;
    border: 1px solid #fbbf24;
}

.complexity-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #b45309;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.complexity-bar-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.complexity-bar {
    flex: 1;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.complexity-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease, background 0.3s ease;
}

.complexity-bar-fill.low {
    background: linear-gradient(90deg, #10b981, #34d399);
}

.complexity-bar-fill.medium {
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
}

.complexity-bar-fill.high {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.complexity-label {
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 40px;
    text-align: right;
}

.complexity-label.low { color: #059669; }
.complexity-label.medium { color: #d97706; }
.complexity-label.high { color: #dc2626; }

.complexity-details {
    margin-top: 8px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.complexity-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    color: #92400e;
    background: rgba(255,255,255,0.5);
    padding: 3px 8px;
    border-radius: 4px;
}

/* Enhanced Optimization Input */
.optimization-input-wrapper {
    position: relative;
}

.optimization-textarea {
    width: 100%;
    height: 80px;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    resize: vertical;
    transition: all 0.2s ease;
    background: #fafafa;
}

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

.optimization-textarea::placeholder {
    color: #94a3b8;
}

/* Optimization Stats */
.optimization-stats {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.optimization-stat {
    flex: 1;
    padding: 8px 12px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    text-align: center;
}

.optimization-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1e293b;
}

.optimization-stat-label {
    font-size: 0.7rem;
    color: #64748b;
    margin-top: 2px;
}

.template-mode-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}
