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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

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

/* Sección de escaneo */
.scan-section {
    background: white;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.camera-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto 20px;
    border-radius: 15px;
    overflow: hidden;
    background: #000;
}

#video {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
}

.camera-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.scan-frame {
    width: 200px;
    height: 200px;
    border: 3px solid #00ff88;
    border-radius: 15px;
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 20px rgba(0, 255, 136, 0.5); }
    50% { box-shadow: 0 0 30px rgba(0, 255, 136, 0.8); }
    100% { box-shadow: 0 0 20px rgba(0, 255, 136, 0.5); }
}

.scan-instructions {
    color: white;
    background: rgba(0,0,0,0.7);
    padding: 10px 20px;
    border-radius: 25px;
    margin-top: 20px;
    font-size: 0.9rem;
}

.camera-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Botones */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 25px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    min-width: 120px;
    justify-content: center;
}

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

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

.btn-secondary {
    background: #f8f9fa;
    color: #495057;
    border: 2px solid #dee2e6;
}

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

.btn-success {
    background: linear-gradient(45deg, #28a745, #20c997);
    color: white;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

.btn-warning {
    background: linear-gradient(45deg, #ffc107, #fd7e14);
    color: white;
}

.btn-warning:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 193, 7, 0.4);
}

.btn-small {
    padding: 8px 12px;
    font-size: 0.9rem;
    min-width: auto;
}

/* Sección de resultados */
.results-section {
    background: white;
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.results-section h3 {
    color: #495057;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
}

.url-display, .url-analysis, .parameters-section, .web-reputation, .security-analysis {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.url-display:last-child, .url-analysis:last-child, .parameters-section:last-child, .web-reputation:last-child, .security-analysis:last-child {
    border-bottom: none;
}

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

.url-container input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    background: #f8f9fa;
}

.url-breakdown {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.url-part {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.url-part label {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

.url-part input {
    padding: 10px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.url-part input:focus {
    outline: none;
    border-color: #667eea;
}

.editable {
    background: white !important;
}

/* Parámetros */
.parameters-table-container {
    margin-bottom: 15px;
    overflow-x: auto;
}

.parameters-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.parameters-table thead {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
}

.parameters-table th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 0.9rem;
}

.parameters-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.parameters-table tbody tr:hover {
    background-color: #f8f9fa;
}

.parameters-table tbody tr:last-child td {
    border-bottom: none;
}

.parameter-item {
    display: flex;
    gap: 10px;
    align-items: center;
}

.parameters-table input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
    background: white;
    box-sizing: border-box;
}

.parameters-table input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.parameters-table .param-key {
    min-width: 120px;
}

.parameters-table .param-value {
    min-width: 200px;
}

.parameters-table button {
    padding: 8px 12px;
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 80px;
    justify-content: center;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.parameters-table button:hover {
    background: #c82333;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(220, 53, 69, 0.3);
}

.parameters-table button i {
    font-size: 0.7rem;
}

/* Estado vacío de la tabla */
.parameters-table tbody:empty::after {
    content: "No hay parámetros. Haz clic en 'Agregar Parámetro' para comenzar.";
    display: block;
    text-align: center;
    padding: 30px;
    color: #6c757d;
    font-style: italic;
    background: #f8f9fa;
    grid-column: 1 / -1;
}

/* Mejoras para el estado vacío en móviles */
@media (max-width: 768px) {
    .parameters-table tbody:empty::after {
        padding: 20px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .parameters-table tbody:empty::after {
        padding: 15px;
        font-size: 0.8rem;
    }
}

/* Botones de acción de parámetros */
.parameters-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.parameters-actions .btn {
    flex: 1;
    max-width: 200px;
}

/* Sección de reputación web */
.web-reputation {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #17a2b8;
}

.web-reputation h3 {
    color: #17a2b8;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.reputation-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.reputation-details {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
}

.reputation-details h4 {
    color: #17a2b8;
    margin-bottom: 10px;
    font-size: 1rem;
}

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

.reputation-item {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid #17a2b8;
}

.reputation-item strong {
    color: #495057;
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.reputation-item span {
    color: #6c757d;
    font-size: 0.85rem;
}

.reputation-score {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.score-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
}

.score-excellent {
    background: #d4edda;
    color: #155724;
}

.score-good {
    background: #d1ecf1;
    color: #0c5460;
}

.score-fair {
    background: #fff3cd;
    color: #856404;
}

.score-poor {
    background: #f8d7da;
    color: #721c24;
}

/* Mejoras para experiencia táctil en móviles */
@media (hover: none) and (pointer: coarse) {
    /* Aumentar área de toque para elementos interactivos */
    .btn {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    .parameters-table button {
        min-height: 36px;
        touch-action: manipulation;
    }
    
    .parameters-table input {
        min-height: 36px;
        touch-action: manipulation;
    }
    
    /* Mejorar scroll táctil */
    .parameters-table-container {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    /* Evitar zoom en inputs */
    input[type="text"], input[type="url"] {
        font-size: 16px !important;
    }
}

/* Mejoras para orientación landscape en móviles */
@media (max-width: 768px) and (orientation: landscape) {
    .container {
        padding: 10px;
    }
    
    header {
        margin-bottom: 20px;
    }
    
    header h1 {
        font-size: 1.6rem;
        margin-bottom: 5px;
    }
    
    header p {
        font-size: 0.9rem;
    }
    
    .camera-container {
        max-width: 300px;
    }
    
    #video {
        height: 180px;
    }
    
    .scan-frame {
        width: 100px;
        height: 100px;
    }
    
    .scan-instructions {
        font-size: 0.7rem;
        padding: 6px 12px;
        margin-top: 10px;
    }
    
    .camera-controls {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 10px;
    }
    
    .btn {
        width: auto;
        max-width: 150px;
        padding: 10px 15px;
        font-size: 0.9rem;
    }
    
    .results-section {
        padding: 15px;
    }
    
    .results-section h3 {
        font-size: 1rem;
        margin-bottom: 10px;
    }
    
    .parameters-table {
        min-width: 450px;
        font-size: 0.8rem;
        table-layout: fixed;
    }
    
    .parameters-table th:nth-child(1),
    .parameters-table td:nth-child(1) {
        width: 25%;
        min-width: 100px;
    }
    
    .parameters-table th:nth-child(2),
    .parameters-table td:nth-child(2) {
        width: 55%;
        min-width: 180px;
    }
    
    .parameters-table th:nth-child(3),
    .parameters-table td:nth-child(3) {
        width: 20%;
        min-width: 80px;
    }
    
    .parameters-table th,
    .parameters-table td {
        padding: 6px 4px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .parameters-table input {
        padding: 4px 6px;
        font-size: 0.8rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .parameters-table button {
        padding: 4px 6px;
        font-size: 0.7rem;
        min-width: 50px;
        white-space: nowrap;
    }
}

/* Análisis de seguridad */
.security-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    border-radius: 25px;
    font-weight: 600;
}

.status-indicator.safe {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-indicator.dangerous {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-indicator.unknown {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.security-details {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #667eea;
}

.security-details h4 {
    margin-bottom: 10px;
    color: #495057;
}

.security-details p {
    margin-bottom: 8px;
    font-size: 0.9rem;
}

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

.security-item {
    background: white;
    padding: 12px;
    border-radius: 6px;
    border-left: 3px solid #ffc107;
}

.security-item strong {
    color: #495057;
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.security-item span {
    color: #6c757d;
    font-size: 0.85rem;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
}

.status-badge.success {
    background: #d4edda;
    color: #155724;
}

.status-badge.warning {
    background: #fff3cd;
    color: #856404;
}

.status-badge.danger {
    background: #f8d7da;
    color: #721c24;
}

/* Botones de acción */
.action-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
}

.modal-header h3 {
    margin: 0;
    color: #495057;
}

.close {
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
}

.close:hover {
    color: #495057;
}

.modal-body {
    padding: 20px;
}

.final-url-container {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    align-items: center;
}

.final-url-container input {
    flex: 1;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-size: 1rem;
    background: #f8f9fa;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Mensajes de estado */
.status-message {
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: 600;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    .camera-controls {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .btn {
        width: 100%;
        max-width: 300px;
        padding: 15px 20px;
        font-size: 1.1rem;
    }
    
    .security-status, .reputation-status {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .action-buttons {
        flex-direction: column;
        align-items: center;
        gap: 15px;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .modal-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    /* Mejoras para la tabla de parámetros en móviles */
    .parameters-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .parameters-table {
        min-width: 600px;
        font-size: 0.9rem;
        table-layout: fixed;
    }
    
    .parameters-table th:nth-child(1),
    .parameters-table td:nth-child(1) {
        width: 30%;
        min-width: 120px;
    }
    
    .parameters-table th:nth-child(2),
    .parameters-table td:nth-child(2) {
        width: 50%;
        min-width: 200px;
    }
    
    .parameters-table th:nth-child(3),
    .parameters-table td:nth-child(3) {
        width: 20%;
        min-width: 100px;
    }
    
    .parameters-table th,
    .parameters-table td {
        padding: 10px 8px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .parameters-table input {
        padding: 8px 10px;
        font-size: 0.9rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .parameters-table button {
        padding: 6px 10px;
        font-size: 0.8rem;
        min-width: 70px;
        white-space: nowrap;
    }
    
    .parameters-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .parameters-actions .btn {
        max-width: none;
    }
    
    /* Mejoras para el análisis de URL */
    .url-breakdown {
        gap: 15px;
    }
    
    .url-part input {
        padding: 12px;
        font-size: 1rem;
    }
    
    /* Mejoras para el modal */
    .final-url-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .final-url-container input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    header p {
        font-size: 0.9rem;
    }
    
    .scan-frame {
        width: 120px;
        height: 120px;
        border-width: 2px;
    }
    
    .scan-instructions {
        font-size: 0.8rem;
        padding: 8px 15px;
        margin-top: 15px;
    }
    
    #video {
        height: 200px;
    }
    
    .btn {
        padding: 12px 16px;
        font-size: 1rem;
        min-width: auto;
    }
    
    /* Tabla de parámetros más compacta */
    .parameters-table {
        min-width: 450px;
        font-size: 0.8rem;
        table-layout: fixed;
    }
    
    .parameters-table th:nth-child(1),
    .parameters-table td:nth-child(1) {
        width: 25%;
        min-width: 100px;
    }
    
    .parameters-table th:nth-child(2),
    .parameters-table td:nth-child(2) {
        width: 55%;
        min-width: 180px;
    }
    
    .parameters-table th:nth-child(3),
    .parameters-table td:nth-child(3) {
        width: 20%;
        min-width: 80px;
    }
    
    .parameters-table th,
    .parameters-table td {
        padding: 8px 6px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .parameters-table input {
        padding: 6px 8px;
        font-size: 0.8rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .parameters-table button {
        padding: 5px 8px;
        font-size: 0.7rem;
        min-width: 60px;
        white-space: nowrap;
    }
    
    /* Mejoras para secciones */
    .results-section h3 {
        font-size: 1.1rem;
    }
    
    .url-container {
        flex-direction: column;
        gap: 10px;
    }
    
    .url-container input {
        width: 100%;
    }
    
    /* Mejoras para el modal */
    .modal-header h3 {
        font-size: 1.2rem;
    }
    
    .modal-body {
        padding: 15px;
    }
}

@media (max-width: 360px) {
    .container {
        padding: 8px;
    }
    
    header h1 {
        font-size: 1.6rem;
    }
    
    .scan-frame {
        width: 100px;
        height: 100px;
    }
    
    #video {
        height: 180px;
    }
    
    .btn {
        padding: 10px 14px;
        font-size: 0.9rem;
    }
    
    /* Tabla de parámetros ultra compacta */
    .parameters-table {
        min-width: 380px;
        font-size: 0.75rem;
        table-layout: fixed;
    }
    
    .parameters-table th:nth-child(1),
    .parameters-table td:nth-child(1) {
        width: 25%;
        min-width: 90px;
    }
    
    .parameters-table th:nth-child(2),
    .parameters-table td:nth-child(2) {
        width: 55%;
        min-width: 160px;
    }
    
    .parameters-table th:nth-child(3),
    .parameters-table td:nth-child(3) {
        width: 20%;
        min-width: 70px;
    }
    
    .parameters-table th,
    .parameters-table td {
        padding: 6px 4px;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .parameters-table input {
        padding: 5px 6px;
        font-size: 0.75rem;
        width: 100%;
        box-sizing: border-box;
    }
    
    .parameters-table button {
        padding: 4px 6px;
        font-size: 0.65rem;
        min-width: 50px;
        white-space: nowrap;
    }
} 