/* CAD Feature Predictor Styles */

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --bg: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Upload Section */
.upload-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.upload-area {
    width: 100%;
    max-width: 500px;
    padding: 3rem 2rem;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--bg-card);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.upload-hint {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.file-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.file-name {
    font-weight: 500;
    color: var(--primary);
}

.btn-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0.25rem;
    transition: color 0.2s;
}

.btn-clear:hover {
    color: var(--error);
}

.btn-predict {
    padding: 1rem 3rem;
    font-size: 1.1rem;
    font-weight: 600;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-predict:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
}

.btn-predict:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Results Section */
.results-section {
    margin-top: 3rem;
    animation: fadeIn 0.5s ease;
}

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

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.results-header h2 {
    font-size: 1.5rem;
}

.btn-download {
    padding: 0.75rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.btn-download:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
}

/* Features Summary */
.features-summary {
    margin-bottom: 2rem;
}

.features-summary h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    transition: all 0.2s;
}

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

.feature-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
    color: var(--primary);
}

.feature-type {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.feature-faces {
    font-size: 0.9rem;
    color: var(--success);
    font-weight: 500;
}

.face-ids {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* Faces Table */
.faces-table-container {
    margin-bottom: 2rem;
}

.faces-table-container h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.faces-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border-radius: var(--radius);
    overflow: hidden;
}

.faces-table th,
.faces-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.faces-table th {
    background: rgba(99, 102, 241, 0.1);
    font-weight: 600;
    color: var(--primary);
}

.faces-table tr:hover {
    background: var(--bg-card-hover);
}

.tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary);
    border-radius: 20px;
    font-size: 0.85rem;
}

/* Raw JSON */
.raw-json {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
}

.raw-json summary {
    cursor: pointer;
    font-weight: 500;
    color: var(--text-muted);
}

.raw-json pre {
    margin-top: 1rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: 8px;
    overflow-x: auto;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Error Section */
.error-section {
    margin-top: 2rem;
}

.error-message {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    border-radius: var(--radius);
    color: var(--error);
}

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

/* Footer */
footer {
    text-align: center;
    margin-top: 4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
}
