/* Reset y estilos base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #f5f7fa;
}

/* Sistema de Pantallas */
.screen {
    display: none;
}

.screen.active {
    display: block;
}

/* Pantalla de Login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-box h1 {
    font-size: 32px;
    text-align: center;
    margin-bottom: 10px;
    color: #667eea;
}

.subtitle {
    text-align: center;
    color: #6c757d;
    margin-bottom: 30px;
    font-size: 14px;
}

/* Formularios */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #495057;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

/* Botones */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-block;
}

.btn-primary {
    background: #667eea;
    color: white;
}

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

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

.btn-secondary:hover {
    background: #5a6268;
}

.btn-success {
    background: #28a745;
    color: white;
}

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

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

.btn-warning {
    background: #ffc107;
    color: #000;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-warning:disabled {
    background: #ccc;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Mensajes */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 14px;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 14px;
}

/* Navbar */
.navbar {
    background: white;
    border-bottom: 1px solid #dee2e6;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.nav-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-content h2 {
    font-size: 24px;
    color: #667eea;
}

.nav-right {
    display: flex;
    gap: 15px;
    align-items: center;
}

.user-info {
    color: #495057;
    font-weight: 500;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
}

/* Sección de Upload */
.upload-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 30px;
}

.upload-section h3 {
    margin-bottom: 20px;
    color: #495057;
}

.drop-zone {
    border: 3px dashed #dee2e6;
    border-radius: 10px;
    padding: 60px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: #667eea;
    background: #f8f9fa;
}

.drop-content .icon {
    font-size: 64px;
    margin-bottom: 15px;
}

.drop-content p {
    margin-bottom: 5px;
}

.drop-content .hint {
    font-size: 12px;
    color: #6c757d;
}

.upload-progress {
    margin-top: 20px;
}

.progress-bar {
    width: 100%;
    height: 30px;
    background: #e9ecef;
    border-radius: 15px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    width: 0%;
    transition: width 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.progress-text {
    text-align: center;
    margin-top: 10px;
    color: #495057;
    font-weight: 500;
}

/* Controles de ajuste de bordes ROI */
.roi-edge-controls {
    margin: 10px 0;
    padding: 10px;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.btn-edge {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    border-radius: 6px;
    transition: all 0.3s;
    border: 2px solid #dee2e6;
    background: white;
    cursor: pointer;
}

.btn-edge.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transform: scale(1.1);
}

.btn-edge:hover:not(.active) {
    background: #e9ecef;
    border-color: #667eea;
    transform: translateY(-2px);
}

.adjusting-hint {
    margin-top: 10px;
    padding: 10px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 5px;
    color: #856404;
}

/* Sección de Trabajos */
.jobs-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h3 {
    color: #495057;
}

.jobs-list {
    display: grid;
    gap: 20px;
}

.job-card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s;
}

.job-card:hover {
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.job-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.job-info h4 {
    color: #333;
    margin-bottom: 5px;
}

.job-meta {
    font-size: 12px;
    color: #6c757d;
}

.job-status {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.job-status.pending {
    background: #ffc107;
    color: #856404;
}

.job-status.processing {
    background: #17a2b8;
    color: white;
}

.job-status.completed {
    background: #28a745;
    color: white;
}

.job-status.failed {
    background: #dc3545;
    color: white;
}

.job-progress {
    margin-bottom: 15px;
}

.job-progress-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.job-progress-fill {
    height: 100%;
    background: #667eea;
    transition: width 0.5s;
}

.job-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 5px;
}

.stat {
    text-align: center;
}

.stat-number {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

.stat-label {
    font-size: 11px;
    color: #6c757d;
    text-transform: uppercase;
}

.job-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.empty-message {
    text-align: center;
    color: #6c757d;
    padding: 40px;
}

/* Sección Admin */
.admin-section {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    margin-bottom: 30px;
}

.admin-section h3 {
    margin-bottom: 20px;
    color: #495057;
}

.users-list {
    display: grid;
    gap: 15px;
}

.user-card {
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info-card {
    flex: 1;
}

.user-info-card h4 {
    color: #333;
    margin-bottom: 5px;
}

.user-info-card .meta {
    font-size: 12px;
    color: #6c757d;
}

.user-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 10px;
    text-transform: uppercase;
}

.user-badge.admin {
    background: #667eea;
    color: white;
}

.user-badge.user {
    background: #6c757d;
    color: white;
}

.user-actions {
    display: flex;
    gap: 10px;
}

/* ROI Selector */
.roi-selector {
    margin-top: 30px;
    padding: 25px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 2px dashed #667eea;
    animation: fadeIn 0.3s ease-in;
}

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

.roi-selector h4 {
    color: #333;
    margin: 0 0 10px 0;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.roi-selector .hint {
    color: #6c757d;
    font-size: 14px;
    margin: 0 0 20px 0;
}

.roi-container {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.frames-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.frame-info {
    font-weight: 600;
    color: #495057;
    font-size: 14px;
}

.canvas-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    margin: 20px 0;
    cursor: crosshair;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

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

.roi-preview {
    margin-top: 15px;
    padding: 12px;
    background: #e7f3ff;
    border-left: 4px solid #667eea;
    border-radius: 4px;
}

.roi-preview p {
    margin: 0;
    font-size: 14px;
    color: #495057;
}

#roiDimensions {
    font-weight: 600;
    color: #667eea;
}

.roi-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.roi-actions .btn {
    min-width: 200px;
}

/* Botón deshabilitado */
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .nav-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .job-header {
        flex-direction: column;
        gap: 10px;
    }
    
    .job-actions {
        flex-direction: column;
    }
    
    .user-card {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
}

