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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.header-logo {
    max-width: 144px;
    height: auto;
    margin: 0 auto 20px;
    display: block;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    opacity: 0.9;
    font-size: 1.1em;
}

.main-content {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 20px;
    padding: 30px;
}

.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.control-group {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
}

.control-group h3 {
    margin-bottom: 15px;
    color: #333;
    font-size: 1.1em;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    width: 100%;
    margin-bottom: 10px;
}

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

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #545b62;
}

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

.btn-upload {
    background: #28a745;
    color: white;
    display: block;
    text-align: center;
}

.btn-upload:hover {
    background: #218838;
}

.btn-tshirt {
    background: #17a2b8;
    color: white;
    margin-bottom: 10px;
}

.btn-tshirt:hover {
    background: #138496;
    transform: translateY(-2px);
}

.btn-tshirt.active {
    background: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.preset-tshirts {
    margin-bottom: 15px;
}

.divider {
    text-align: center;
    color: #999;
    font-size: 12px;
    font-weight: 600;
    margin: 15px 0;
    position: relative;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: #ddd;
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

.file-input {
    display: none;
}

.tshirt-preview {
    margin-top: 15px;
    min-height: 100px;
    border: 2px dashed #ddd;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
}

.tshirt-preview img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 8px;
}

.tshirt-preview.empty::after {
    content: 'No t-shirt loaded';
    color: #999;
    font-size: 14px;
}

label {
    display: block;
    margin-bottom: 15px;
    color: #555;
    font-weight: 500;
}

label input[type="range"] {
    width: 100%;
    margin-top: 8px;
}

label input[type="checkbox"] {
    margin-right: 8px;
}

.stats {
    background: white;
    padding: 15px;
    border-radius: 8px;
    font-size: 14px;
}

.stats div {
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.stats div:last-child {
    border-bottom: none;
}

.stats span {
    float: right;
    font-weight: 600;
    color: #667eea;
}

.video-section {
    display: flex;
    justify-content: center;
    align-items: center;
}

.video-container {
    position: relative;
    background: #000;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 100%;
}

#webcam {
    display: none;
}

#output {
    display: block;
    max-width: 100%;
    height: auto;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    color: white;
    z-index: 10;
}

.loading-overlay.hidden {
    display: none;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .controls-panel {
        order: 2;
    }
    
    .video-section {
        order: 1;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.8em;
    }
    
    .main-content {
        padding: 15px;
    }
}
