/* 🐟💥 Fishcannon - Main Styles */
/* Consistent with Vibecoding design system */

/* ===== CSS RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #121212;
    color: #ffffff;
    overflow-x: hidden;
}

/* ===== LAYOUT ===== */
body {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
}

.app-header {
    display: none; /* Hide header for fullscreen mode */
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
}

.app-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
}

.fish-icon, .cannon-icon {
    font-size: 3rem;
    animation: float 2s ease-in-out infinite alternate;
}

.cannon-icon {
    animation-delay: 1s;
}

@keyframes float {
    0% { transform: translateY(0px); }
    100% { transform: translateY(-10px); }
}

.app-subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    font-weight: 300;
}

.app-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    display: block;
}

/* ===== CANVAS SYSTEM ===== */
.canvas-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(180deg, #87CEEB 0%, #4682B4 50%, #2F4F4F 100%);
    z-index: 1;
}

.canvas-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.animation-layer {
    pointer-events: auto; /* Allow interactions on animation layer */
}

/* Position Indicators */
.position-indicators {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50; /* Ensure indicators are above canvas layers */
}

/* Allow multimode indicators to have pointer events */
.position-indicators .multimode-indicator {
    pointer-events: auto !important;
    z-index: 100 !important;
}

.position-indicator {
    position: absolute;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid #3498db;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: move;
    pointer-events: auto;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.position-indicator:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
    box-shadow: 0 4px 20px rgba(52, 152, 219, 0.4);
}

.position-indicator.dragging {
    transform: scale(1.2);
    z-index: 1000;
    box-shadow: 0 8px 30px rgba(52, 152, 219, 0.6);
}

.fish-indicator {
    bottom: 20%;
    left: 10%;
    border-color: #2ecc71;
}

.target-indicator {
    top: 30%;
    right: 20%;
    border-color: #e74c3c;
}

/* ===== CONTROL PANELS ===== */
.control-panels {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 400px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 10;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    transition: transform 0.3s ease;
    box-sizing: border-box;
}

.control-panels.hidden {
    transform: translateX(calc(100% + 20px));
}

.control-panel {
    background: rgba(0, 0, 0, 0.85);
    border-radius: 12px;
    padding: 1.5rem;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    max-width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
}

.control-panel:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: rgba(52, 152, 219, 0.4);
}

.panel-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #3498db;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-group {
    margin-bottom: 1.5rem;
}

.control-group:last-child {
    margin-bottom: 0;
}

.control-title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
    color: #ecf0f1;
}

/* ===== BUTTONS ===== */
.action-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
    width: 100%;
    text-transform: none;
}

.primary-button {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
}

.primary-button:hover {
    background: linear-gradient(135deg, #2980b9, #1f639a);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.3);
}

.secondary-button {
    background: linear-gradient(135deg, #95a5a6, #7f8c8d);
    color: white;
}

.secondary-button:hover {
    background: linear-gradient(135deg, #7f8c8d, #6c7b7d);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(149, 165, 166, 0.3);
}

.toggle-button {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
}

.toggle-button:hover {
    background: linear-gradient(135deg, #27ae60, #1e8449);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 204, 113, 0.3);
}

.toggle-button.active {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.toggle-button.active:hover {
    background: linear-gradient(135deg, #c0392b, #a93226);
}

.button-icon {
    font-size: 1.1rem;
}

/* ===== PARAMETER CONTROLS ===== */
.parameter-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.parameter-control {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.parameter-control label {
    flex: 1;
    font-size: 0.9rem;
    color: #bdc3c7;
    min-width: 80px;
}

.parameter-control input[type="range"] {
    flex: 2;
    height: 6px;
    border-radius: 3px;
    background: #34495e;
    outline: none;
    -webkit-appearance: none;
}

.parameter-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.3);
}

.parameter-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #3498db;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.3);
}

.parameter-control span {
    min-width: 50px;
    text-align: right;
    font-size: 0.9rem;
    font-weight: 500;
    color: #3498db;
}

/* ===== AUDIO VISUALIZATION ===== */
.audio-visualization {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.volume-meter {
    height: 8px;
    background: #34495e;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.volume-bar {
    height: 100%;
    background: linear-gradient(90deg, #2ecc71, #f1c40f, #e74c3c);
    width: 0%;
    transition: width 0.1s ease;
    border-radius: 4px;
}

.audio-status {
    font-size: 0.85rem;
    color: #bdc3c7;
    text-align: center;
    margin: 0;
}

/* ===== STATUS PANEL ===== */
.status-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

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

.status-label {
    font-size: 0.9rem;
    color: #bdc3c7;
}

.status-value {
    font-size: 0.9rem;
    font-weight: 500;
    color: #3498db;
}

/* ===== FOOTER ===== */
.app-footer {
    display: none; /* Hide footer for fullscreen mode */
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1200px) {
    .app-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    
    .control-panels {
        position: relative;
        top: auto;
        right: auto;
        width: 100%;
        max-width: 100%;
        max-height: none;
        overflow-y: visible;
        overflow-x: hidden;
        grid-row: 1;
    }
    
    .canvas-container {
        grid-row: 2;
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    .app-container {
        padding: 1rem;
        gap: 1rem;
    }
    
    .app-title {
        font-size: 2rem;
    }
    
    .control-panel {
        padding: 1rem;
    }
    
    .parameter-control {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .parameter-control input[type="range"] {
        width: 100%;
    }
}

/* ===== SCROLLBAR STYLING ===== */
.control-panels::-webkit-scrollbar {
    width: 6px;
}

.control-panels::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.control-panels::-webkit-scrollbar-thumb {
    background: #3498db;
    border-radius: 3px;
}

.control-panels::-webkit-scrollbar-thumb:hover {
    background: #2980b9;
}

/* ===== ENHANCED POSITION INDICATORS ===== */
.position-indicator {
    position: absolute;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.15);
    border: 3px solid #3498db;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: move;
    pointer-events: auto;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    user-select: none;
    will-change: transform;
    z-index: 100;
}

.position-indicator:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(52, 152, 219, 0.5);
    border-width: 4px;
}

.position-indicator.dragging {
    transform: scale(1.2);
    z-index: 1000;
    box-shadow: 0 10px 35px rgba(52, 152, 219, 0.7);
    border-width: 4px;
    background: rgba(255, 255, 255, 0.3);
    transition: none; /* Disable transition while dragging for smoothness */
}

.fish-indicator {
    border-color: #2ecc71;
    box-shadow: 0 4px 20px rgba(46, 204, 113, 0.3);
}

.fish-indicator:hover {
    box-shadow: 0 6px 25px rgba(46, 204, 113, 0.5);
    border-color: #27ae60;
}

.fish-indicator.dragging {
    box-shadow: 0 10px 35px rgba(46, 204, 113, 0.7);
    border-color: #27ae60;
}

.target-indicator {
    border-color: #e74c3c;
    box-shadow: 0 4px 20px rgba(231, 76, 60, 0.3);
}

.target-indicator:hover {
    box-shadow: 0 6px 25px rgba(231, 76, 60, 0.5);
    border-color: #c0392b;
}

.target-indicator.dragging {
    box-shadow: 0 10px 35px rgba(231, 76, 60, 0.7);
    border-color: #c0392b;
}

/* ===== CANVAS PERFORMANCE ===== */
.canvas-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    image-rendering: optimizeSpeed;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: optimize-contrast;
    z-index: 1; /* Ensure canvas layers are below indicators */
}

.animation-layer {
    pointer-events: auto;
    will-change: contents; /* Optimize for frequent updates */
}

/* ===== SMOOTH ANIMATIONS ===== */
.canvas-container {
    position: relative;
    background: linear-gradient(180deg, #87CEEB 0%, #4682B4 50%, #2F4F4F 100%);
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    min-height: 600px;
    aspect-ratio: 16/10;
    will-change: transform; /* Optimize for smooth rendering */
}

/* ===== LOADING STATES ===== */
.action-button.loading {
    position: relative;
    pointer-events: none;
    overflow: hidden;
}

.action-button.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: buttonSpin 1s linear infinite;
    z-index: 1;
}

.action-button.loading .button-icon,
.action-button.loading span:not(.button-icon) {
    opacity: 0.3;
}

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

/* ===== TRAJECTORY PREVIEW ===== */
.trajectory-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

/* ===== MOBILE OPTIMIZATIONS ===== */
@media (max-width: 768px) {
    .position-indicator {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .position-indicator:hover {
        transform: scale(1.05); /* Smaller scale on mobile */
    }
    
    .position-indicator.dragging {
        transform: scale(1.15);
    }
}

/* ===== ACCESSIBILITY ===== */
.position-indicator:focus {
    outline: 3px solid #3498db;
    outline-offset: 3px;
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
* {
    -webkit-tap-highlight-color: transparent;
}

.canvas-container * {
    transform3d: 0, 0, 0; /* Force hardware acceleration */
}

/* ===== HIGH DPI SUPPORT ===== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .canvas-layer {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* ===== FISH LAYER (Between background and foreground) ===== */
.background-layer {
    z-index: 1;
}

.fish-layer {
    z-index: 4; /* Increased to be above foreground */
}

.foreground-layer {
    z-index: 3;
}

.animation-layer {
    z-index: 5;
}

.ui-layer {
    z-index: 6;
}

/* Ensure proper stacking context */
.canvas-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    image-rendering: optimizeSpeed;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: optimize-contrast;
}

/* ===== INDICATOR VISIBILITY CONTROLS ===== */
.position-indicators {
    transition: opacity 0.3s ease;
}

.position-indicators.hidden {
    opacity: 0;
    pointer-events: none;
}

.position-indicator {
    transition: all 0.3s ease, opacity 0.3s ease;
}

.position-indicator.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: scale(0.8);
}

/* ===== TOGGLE BUTTON STATES ===== */
.toggle-button.active {
    background: linear-gradient(135deg, #e74c3c, #c0392b) !important;
}

.toggle-button.active:hover {
    background: linear-gradient(135deg, #c0392b, #a93226) !important;
}

.toggle-button.active .button-icon {
    transform: rotate(180deg);
    transition: transform 0.3s ease;
}

/* ===== KEYBOARD SHORTCUTS HELP ===== */
.keyboard-shortcuts {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.8);
    padding: 1rem;
    border-radius: 8px;
    color: white;
    font-size: 0.8rem;
    opacity: 0.8;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 10000;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.keyboard-shortcuts.visible {
    opacity: 1;
    pointer-events: auto;
}

.keyboard-shortcuts.hidden {
    display: none;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    gap: 1rem;
}

.shortcut-item:last-child {
    margin-bottom: 0;
}

.shortcut-key {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-family: monospace;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}

.shortcut-description {
    color: #bdc3c7;
}

/* ===== TEMPORARY INDICATOR FLASH ===== */
.position-indicator.temp-visible {
    animation: tempFlash 3s ease-in-out;
}

@keyframes tempFlash {
    0% { opacity: 0; transform: scale(0.8); }
    10% { opacity: 1; transform: scale(1.1); }
    20% { opacity: 1; transform: scale(1); }
    90% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.8); }
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 768px) {
    .keyboard-shortcuts {
        display: none; /* Hide on mobile */
    }
}

/* Position indicators should be above all canvas layers */
.position-indicators {
    z-index: 50 !important;
}

.emoji-buttons {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: row;
    gap: 10px;
    z-index: 1000;
}

.emoji-button-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.hotkey-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.7);
    font-family: monospace;
    background: rgba(0, 0, 0, 0.5);
    padding: 2px 4px;
    border-radius: 3px;
    min-width: 20px;
    text-align: center;
}
