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

body {
    font-family: 'JetBrains Mono', monospace;
    background: linear-gradient(135deg, #1e1e1e, #2d2d2d);
    height: 100vh; /* fallback */
    height: 100dvh; /* mobile-friendly dynamic viewport */
    margin: 0;
    padding: 0;
    padding-top: env(safe-area-inset-top);
    overflow: hidden;
}

.terminal-container {
    width: 100vw;
    height: 100vh; /* fallback */
    height: 100dvh; /* dynamic viewport to avoid URL bar overlap */
    background: #0c0c0c;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}

.terminal-header {
    background: #2d2d2d;
    padding: calc(10px + env(safe-area-inset-top)) 15px 10px 15px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid #404040;
    position: sticky;
    top: 0;
    z-index: 2;
}

/* Barra de estado del dron */
.drone-status-bar {
    background: #1a1a1a;
    border-bottom: 1px solid #333;
    padding: 8px 15px;
    display: flex;
    align-items: center;
    font-size: 12px;
    min-height: 32px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-icon {
    font-size: 14px;
}

.status-label {
    color: #888;
    font-weight: 600;
}

.status-value {
    color: #27ca3f;
    font-weight: 600;
    background: rgba(39, 202, 63, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid rgba(39, 202, 63, 0.3);
}

/* Estilo para el tema rojo (Jackson) */
.drone-jackson .status-value {
    color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
    border-color: rgba(231, 76, 60, 0.3);
}

/* Estilo para el tema azul (Jameson) */
.drone-jameson .status-value {
    color: #4aa3ff;
    background: rgba(74, 163, 255, 0.1);
    border-color: rgba(74, 163, 255, 0.3);
}

.terminal-buttons {
    display: flex;
    gap: 8px;
    margin-right: 15px;
}

.button {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    cursor: pointer;
}

.close {
    background: #ff5f56;
}

.minimize {
    background: #ffbd2e;
}

.maximize {
    background: #27ca3f;
}

.terminal-title {
    color: #cccccc;
    font-size: 14px;
    font-weight: 500;
    flex: 1;
}

.reset-button-container {
    display: flex;
    align-items: center;
    margin-left: auto;
}

.reset-button {
    background: #404040;
    border: 1px solid #666666;
    border-radius: 4px;
    color: #cccccc;
    cursor: pointer;
    padding: 6px 10px;
    font-size: 12px;
    transition: all 0.2s ease;
    display: none; /* Oculto por defecto */
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 24px;
}

.reset-button:hover {
    background: #555555;
    border-color: #888888;
    color: #ffffff;
    transform: scale(1.05);
}

.reset-button:active {
    transform: scale(0.95);
}

.reset-icon {
    font-size: 14px;
    line-height: 1;
}

.terminal-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0c0c0c;
    min-height: 0; /* Importante para que flex funcione correctamente */
}

.terminal-output {
    flex: 1;
    overflow-y: scroll !important;
    overflow-x: hidden;
    font-size: 14px;
    line-height: 1.5;
    padding: 20px 20px 0 20px;
    padding-right: 35px; /* Más espacio para el scrollbar */
    scroll-behavior: smooth;
    min-height: 0; /* Importante para que flex funcione correctamente */
}

.terminal-output::-webkit-scrollbar {
    width: 16px !important;
    background-color: #1a1a1a !important;
}

.terminal-output::-webkit-scrollbar-track {
    background: #2a2a2a !important;
    border-radius: 8px;
    border: 2px solid #444444 !important;
    margin: 2px;
}

.terminal-output::-webkit-scrollbar-thumb {
    background: #888888 !important;
    border-radius: 8px;
    border: 2px solid #aaaaaa !important;
    min-height: 30px;
}

.terminal-output::-webkit-scrollbar-thumb:hover {
    background: #aaaaaa !important;
}

.terminal-output::-webkit-scrollbar-corner {
    background: #1a1a1a !important;
}

/* Para Firefox */
.terminal-output {
    scrollbar-width: auto !important;
    scrollbar-color: #888888 #2a2a2a !important;
}

.output-line {
    margin-bottom: 8px;
    word-wrap: break-word;
}

.prompt {
    color: #27ca3f;
    font-weight: 600;
    margin-right: 10px;
}

/* Prompt azul en Jameson */
.drone-jameson .prompt {
    color: #4aa3ff;
}

.command {
    color: #ffffff;
    font-weight: 500;
}

.text {
    color: #cccccc;
}

.error {
    color: #ff5f56;
}

.success {
    color: #27ca3f;
}

.warning {
    color: #ffbd2e;
}

.terminal-input-line {
    display: flex;
    align-items: center;
    background: #0c0c0c;
    border-top: 1px solid #404040;
    padding: 15px 20px;
    min-height: 60px;
    flex-shrink: 0; /* Evitar que se encoja */
}

.terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #ffffff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    outline: none;
    margin-left: 10px;
    position: relative;
    caret-color: transparent; /* Ocultar el cursor nativo */
}

.terminal-input::placeholder {
    color: #666666;
}

/* Responsive design */
@media (max-width: 768px) {
    .terminal-output {
        font-size: 13px;
        padding: 15px 15px 0 15px;
        padding-right: 30px;
    }
    
    .terminal-input-line {
        padding: 12px 15px;
        min-height: 50px;
    }
    
    .terminal-input {
        font-size: 13px;
    }
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

/* Efectos hover para los botones */
.button:hover {
    filter: brightness(1.2);
}

/* Estilo para comandos ejecutados */
.command-executed {
    color: #888888;
    font-style: italic;
}

/* Estilos para respuestas del dron */
.drone-response {
    color: #27ca3f;
    font-weight: 600;
    font-size: 14px;
    margin-top: 8px;
}

/* Respuesta azul en Jameson */
.drone-jameson .drone-response {
    color: #4aa3ff;
}

.drone-message {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(39, 202, 63, 0.1), rgba(31, 157, 46, 0.1));
    border-left: 3px solid #27ca3f;
    padding: 8px 12px;
    margin: 4px 0 8px 0;
    border-radius: 0 6px 6px 0;
    font-style: italic;
    line-height: 1.4;
}

/* Mensaje azul en Jameson */
.drone-jameson .drone-message {
    background: linear-gradient(135deg, rgba(74, 163, 255, 0.1), rgba(40, 120, 200, 0.1));
    border-left: 3px solid #4aa3ff;
}

/* Estilos para mensajes del dron con foto */
.drone-message-with-photo {
    color: #ffffff;
    background: linear-gradient(135deg, rgba(39, 202, 63, 0.1), rgba(31, 157, 46, 0.1));
    border-left: 3px solid #27ca3f;
    padding: 8px 12px;
    margin: 4px 0 8px 0;
    border-radius: 0 6px 6px 0;
    font-style: italic;
    line-height: 1.4;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

/* Mensaje con foto (estilo base); en Jameson igual pero no se muestran fotos por JS */
.drone-jameson .drone-message-with-photo {
    background: linear-gradient(135deg, rgba(74, 163, 255, 0.1), rgba(40, 120, 200, 0.1));
    border-left: 3px solid #4aa3ff;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.photo-thumbnail {
    flex-shrink: 0;
    width: 80px;
    height: 60px;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid rgba(39, 202, 63, 0.3);
    cursor: pointer;
    transition: all 0.2s ease;
}

.photo-thumbnail:hover {
    border-color: rgba(39, 202, 63, 0.6);
    transform: scale(1.05);
}

/* Thumbnails no se muestran en Jameson por JS, pero dejamos estilos neutrales */

.thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s ease;
}

.photo-thumbnail:hover .thumbnail-image {
    transform: scale(1.1);
}

/* Estilos para thumbnails de video */
.video-thumbnail {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.6));
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    transition: all 0.2s ease;
}

.video-icon {
    font-size: 20px;
    margin-bottom: 4px;
    opacity: 0.8;
}

.play-button {
    font-size: 16px;
    margin-bottom: 4px;
    opacity: 0.9;
}

.video-filename {
    font-size: 8px;
    text-align: center;
    color: #ffffff;
    opacity: 0.7;
    line-height: 1.2;
    max-width: 100%;
    word-break: break-word;
    padding: 0 2px;
}

.drone-location {
    color: #6a9dc1;
    font-style: italic;
    padding: 4px 8px;
    margin: 2px 0;
    border-left: 2px solid #6a9dc1;
    background: rgba(106, 157, 193, 0.1);
    border-radius: 2px;
}

/* Estilos para Jackson (colores rojos) */
.drone-jackson .drone-response {
    color: #e74c3c;
}

.drone-jackson .drone-message {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.1), rgba(192, 57, 43, 0.1));
    border-left: 3px solid #e74c3c;
}

.drone-jackson .drone-message-with-photo {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.1), rgba(192, 57, 43, 0.1));
    border-left: 3px solid #e74c3c;
}

.drone-jackson .photo-thumbnail {
    border-color: rgba(231, 76, 60, 0.3);
}

.drone-jackson .photo-thumbnail:hover {
    border-color: rgba(231, 76, 60, 0.6);
}

.drone-jackson .video-thumbnail {
    background: linear-gradient(135deg, rgba(231, 76, 60, 0.2), rgba(192, 57, 43, 0.2));
}

/* Estilos para archivos adjuntos */
.attachments {
    color: #888888;
    font-size: 13px;
    margin-top: 4px;
    margin-bottom: 8px;
    font-style: italic;
    margin-left: 12px;
}

.attachment-link {
    color: #27ca3f;
    text-decoration: none;
    transition: color 0.2s ease;
}

.attachment-link:hover {
    color: #1e9b2e;
    text-decoration: underline;
}

/* En Jameson no se muestran adjuntos por JS, pero definimos color base si hiciera falta */
.drone-jameson .attachment-link {
    color: #4aa3ff;
}

.drone-jameson .attachment-link:hover {
    color: #2b7ad6;
}

/* Estilos para elementos de archivo en el panel */
.file-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #2a2a2a;
    transition: background-color 0.2s ease;
}

.file-item:hover {
    background-color: #2a2a2a;
}

.file-item:last-child {
    border-bottom: none;
}

.file-icon {
    font-size: 24px;
    margin-right: 12px;
    min-width: 24px;
}

.file-info {
    flex: 1;
    min-width: 0;
}

.file-name {
    font-weight: 500;
    color: #ffffff;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-url {
    font-size: 12px;
    color: #888888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-actions {
    margin-left: 12px;
}

.file-download {
    display: inline-block;
    padding: 6px;
    color: #27ca3f;
    text-decoration: none;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.file-download:hover {
    background-color: rgba(39, 202, 63, 0.1);
    color: #1e9b2e;
}

/* Estilos para Jackson (archivos rojos) */
.drone-jackson .file-download {
    color: #e74c3c;
}

.drone-jackson .file-download:hover {
    background-color: rgba(231, 76, 60, 0.1);
    color: #c0392b;
}

/* En Jameson ocultamos todo el UI de archivos */
.drone-jameson .files-tab,
.drone-jameson .files-panel {
    display: none !important;
}

.drone-jackson .files-tab {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.drone-jackson .files-tab:hover {
    background: linear-gradient(135deg, #f39c12, #e74c3c);
}

.drone-jackson .file-item::before {
    background: linear-gradient(180deg, #e74c3c, #c0392b);
}

.drone-jackson .file-item:hover {
    border-color: #e74c3c;
}

.drone-jackson .file-actions button:hover {
    background: linear-gradient(135deg, #e74c3c, #f39c12);
    box-shadow: 0 4px 8px rgba(231, 76, 60, 0.3);
}

.drone-jackson .custom-cursor {
    color: #e74c3c;
}

.drone-jackson .terminal-title {
    color: #e74c3c;
}

.drone-jackson .prompt {
    color: #e74c3c;
}

.drone-jackson .command-executed {
    color: #e74c3c;
}

.drone-jackson .terminal-input {
    color: #e74c3c;
}

.drone-jackson .terminal-input::placeholder {
    color: rgba(231, 76, 60, 0.6);
}

/* Estilos del botón de reset para el tema del dron Johnson */
.drone-jackson .reset-button {
    background: #4a2a2a;
    border-color: #8a4a4a;
    color: #ffcccc;
}

.drone-jackson .reset-button:hover {
    background: #6a3a3a;
    border-color: #aa6a6a;
    color: #ffffff;
}

/* Estilos para acceso denegado */
.terminal-input:disabled {
    color: #666666;
    cursor: not-allowed;
}

.terminal-input:disabled::placeholder {
    color: #ff5f56;
    font-style: italic;
}

/* Animación de espera en el input de la terminal */
.terminal-input.waiting {
    background: linear-gradient(90deg, #222 25%, #333 50%, #222 75%);
    background-size: 200% 100%;
    animation: loadingInputBg 1.2s linear infinite;
    color: #aaaaaa;
    cursor: wait;
}

@keyframes loadingInputBg {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.terminal-input-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-left: 8px;
    vertical-align: middle;
    border: 2px solid #27ca3f;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spinInput 0.8s linear infinite;
}

/* Spinner azul en Jameson */
.drone-jameson .terminal-input-spinner {
    border: 2px solid #4aa3ff;
    border-top: 2px solid transparent;
}

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

/* Panel de archivos del dron */
.files-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: #1a1a1a;
    border-left: 2px solid #404040;
    transition: right 0.3s ease;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.files-panel.open {
    right: 0;
}

.files-header {
    background: #2d2d2d;
    padding: 15px 20px;
    border-bottom: 1px solid #404040;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.files-header h3 {
    color: #ffffff;
    margin: 0;
    font-size: 16px;
}

.close-panel {
    background: none;
    border: none;
    color: #cccccc;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-panel:hover {
    background: #404040;
    color: #ffffff;
}

.files-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.no-files {
    text-align: center;
    color: #888888;
    margin-top: 50px;
}

.no-files p {
    margin: 10px 0;
    font-size: 14px;
}

/* Estilos de progreso de timeout en input */
.terminal-input.timeout-progress-active {
    --timeout-progress: 0%;
    background: linear-gradient(90deg, rgba(39, 202, 63, 0.8) var(--timeout-progress), transparent var(--timeout-progress));
    color: #ffffff !important;
    text-shadow: 0 0 10px rgba(39, 202, 63, 0.8);
    box-shadow: 0 0 20px rgba(39, 202, 63, 0.5);
    border-color: #27ca3f;
    transition: all 0.3s ease;
}

/* Variante roja */
.drone-jackson .terminal-input.timeout-progress-active {
    background: linear-gradient(90deg, rgba(231, 76, 60, 0.8) var(--timeout-progress), transparent var(--timeout-progress));
    color: #ffffff !important;
    text-shadow: 0 0 10px rgba(231, 76, 60, 0.8);
    box-shadow: 0 0 20px rgba(231, 76, 60, 0.5);
    border-color: #e74c3c;
}

/* Variante azul */
.drone-jameson .terminal-input.timeout-progress-active {
    background: linear-gradient(90deg, rgba(74, 163, 255, 0.8) var(--timeout-progress), transparent var(--timeout-progress));
    color: #ffffff !important;
    text-shadow: 0 0 10px rgba(74, 163, 255, 0.8);
    box-shadow: 0 0 20px rgba(74, 163, 255, 0.5);
    border-color: #4aa3ff;
} 

/* Solapa para abrir el panel */
.files-tab {
    position: fixed;
    top: 50%;
    right: 0;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #27ca3f, #1f9d2e);
    border-radius: 10px 0 0 10px;
    padding: 15px 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 999;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.3);
}

.files-tab:hover {
    background: linear-gradient(135deg, #2edb4a, #27ca3f);
    transform: translateY(-50%) translateX(-5px);
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.4);
}

.tab-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    font-weight: 600;
}

.tab-icon {
    font-size: 24px;
    margin-bottom: 5px;
}

.tab-text {
    font-size: 12px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
}

/* Responsive para el panel */
@media (max-width: 768px) {
    .files-panel {
        width: 100vw;
        right: -100vw;
    }
    
    .files-tab {
        padding: 12px 8px;
    }
    
    .tab-icon {
        font-size: 20px;
    }
    
    .tab-text {
        font-size: 10px;
    }
}

/* Estilos para los fuegos artificiales */
@keyframes fireworkExplosion {
    0% {
        transform: scale(0);
        opacity: 1;
    }
    50% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(0);
        opacity: 0;
    }
}

.firework {
    position: absolute;
    pointer-events: none;
    z-index: 9999;
}

/* Efectos adicionales para los fuegos artificiales */
.firework::before,
.firework::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: inherit;
    animation: fireworkExplosion 2s ease-out forwards;
}

.firework::before {
    animation-delay: 0.1s;
    transform: translate(-50%, -50%) scale(0);
}

.firework::after {
    animation-delay: 0.2s;
    transform: translate(-50%, -50%) scale(0);
}

/* Variaciones de colores para los fuegos artificiales */
.firework:nth-child(3n) {
    filter: hue-rotate(60deg);
}

.firework:nth-child(3n+1) {
    filter: hue-rotate(120deg);
}

.firework:nth-child(3n+2) {
    filter: hue-rotate(180deg);
}

/* Efecto de partículas adicionales */
.firework::before {
    box-shadow: 
        0 0 20px currentColor,
        0 0 40px currentColor,
        0 0 60px currentColor;
}

.firework::after {
    box-shadow: 
        0 0 15px currentColor,
        0 0 30px currentColor,
        0 0 45px currentColor;
}