/* Global Styles */
* { box-sizing: border-box; }

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background-color: #1e1e1e; color: #e0e0e0; margin: 0; padding: 20px; }
.dashboard { display: flex; gap: 20px; margin-bottom: 20px; flex-wrap: wrap; align-items: stretch; }
.card { background-color: #2d2d2d; padding: 15px; border-radius: 8px; min-width: 150px; box-shadow: 0 4px 6px rgba(0,0,0,0.3); flex: 1; }
.card h3 { margin: 0 0 10px 0; font-size: 14px; color: #888; }
.card .value { font-size: 24px; font-weight: bold; }
.card .sub-value { font-size: 12px; color: #888; margin-top: 5px; }
.green { color: #4caf50; }
.red { color: #f44336; }
#chart { width: 100%; height: 600px; border-radius: 8px; overflow: hidden; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-top: 10px; }
.stat-box { background: #363636; padding: 10px; border-radius: 4px; text-align: center; }
.stat-label { font-size: 11px; color: #aaa; margin-bottom: 4px; }
.stat-val { font-size: 16px; font-weight: bold; color: #fff; }
.stat-apr { font-size: 11px; color: #4caf50; }

/* Neon Pulse Effect */
#chart-wrapper { position: relative; width: 100%; height: 600px; }
#chart { width: 100%; height: 100%; border-radius: 8px; overflow: hidden; }

.pulse-container {
    position: absolute;
    width: 0;
    height: 0;
    pointer-events: none;
    z-index: 10;
    display: none; /* Hidden until positioned */
}
.pulse-line {
    position: absolute;
    left: -6px; /* Adjusted dynamically in JS */
    top: -1px; /* Center vertically on price */
    width: 12px; /* Adjusted dynamically in JS */
    height: 2px;
    background: transparent;
    box-shadow: none;
    opacity: 0;
}
.pulse-wave {
    position: absolute;
    left: -6px; /* Adjusted dynamically in JS */
    top: -1px; /* Center vertically on price */
    width: 12px; /* Adjusted dynamically in JS */
    height: 2px;
    background: linear-gradient(to top, rgba(0, 255, 0, 0.8), transparent);
    opacity: 0;
    transform-origin: bottom center;
    animation: pulse-wave-up 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}
.pulse-label {
    position: absolute;
    left: 15px; /* Right of the candle */
    top: -10px;
    color: rgba(0, 255, 0, 0.7); /* 30% transparent */
    font-size: 12px;
    font-weight: bold;
    text-shadow: 0 0 5px rgba(0,0,0,0.8);
    white-space: nowrap;
}
.pulse-max-mark {
    position: absolute;
    height: 2px;
    background: rgba(64, 224, 208, 0.6); /* Turquoise semi-transparent */
    box-shadow: 0 0 5px rgba(64, 224, 208, 0.4);
    top: 0; /* Adjusted dynamically */
    left: 0; /* Adjusted dynamically */
    /* width set dynamically */
    pointer-events: none;
    transition: top 0.2s ease-out;
}

.orbit-icon {
    transition: transform 0.3s, filter 0.3s, opacity 0.3s;
}
.shimmer-red {
    box-shadow: inset 0 0 5px #f44336;
    border-radius: 4px;
}
.shimmer-red img, .shimmer-red .orbit-icon {
    opacity: 0.5;
}
.shimmer-green {
    box-shadow: inset 0 0 5px #4caf50;
    border-radius: 4px;
}
.shimmer-green img, .shimmer-green .orbit-icon {
    opacity: 0.5;
}

/* Icon Shadows (Drop Shadow on Image) */
.icon-shadow-red {
    filter: drop-shadow(0 5px 5px #f44336) !important;
    opacity: 1 !important;
    transform: scale(1.1); /* Optional: slight pop */
}
.icon-shadow-green {
    filter: drop-shadow(0 5px 5px #4caf50) !important;
    opacity: 1 !important;
    transform: scale(1.1);
}

.pulse-wave:nth-child(2) { animation-delay: 0.6s; }
.pulse-wave:nth-child(3) { animation-delay: 1.2s; }

@keyframes pulse-wave-up {
    0% { transform: translateY(0) scaleY(1); opacity: 0.6; }
    100% { 
        transform: translateY(var(--wave-dist, -50px)) scaleY(var(--wave-scale, 20)); 
        opacity: 0; 
    }
}

.chart-tooltip {
    position: absolute;
    display: none;
    padding: 8px;
    box-sizing: border-box;
    font-size: 12px;
    text-align: left;
    z-index: 1000;
    top: 12px;
    left: 12px;
    pointer-events: none;
    border: 1px solid #4caf50;
    border-radius: 4px;
    background: rgba(30, 30, 30, 0.9);
    color: #e0e0e0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.info-tooltip {
    position: relative;
    display: inline-block;
}
.info-tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 135%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 11px;
    border: 1px solid #555;
    pointer-events: none;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}
.info-tooltip .tooltip-text::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #555 transparent transparent transparent;
}
.info-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

.btn-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: bold;
    font-size: 13px;
    transition: opacity 0.2s;
    margin-top: 8px;
    width: 140px; /* Fixed width */
}
.btn-link:hover { opacity: 0.9; }
.btn-telegram {
    background-color: transparent;
    color: #229ED9;
    border: none;
}
.btn-bybit {
    background-color: transparent;
    padding: 4px; /* Reduced padding for image */
    border: none;
}
.btn-icon {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    fill: currentColor;
}
.btn-img {
    height: 17px; /* Reduced by another 10% */
    width: auto;
    display: block;
}
.qa-item {
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    position: relative;
    width: fit-content;
}
.qa-item:hover {
    color: #4caf50 !important;
    transform: translateX(5px);
}

.tf-btn {
    background: transparent;
    border: none;
    color: #888;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}
.tf-btn:hover {
    color: #e0e0e0;
    background: rgba(255,255,255,0.05);
}
.tf-btn.active {
    color: #4caf50;
    font-weight: bold;
}

.chart-log-wrapper {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

/* Chart Controls Layout */
.chart-controls {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 70px; /* Leave space for price scale if needed, though scale is inside canvas */
    z-index: 20;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    pointer-events: none; /* Let clicks pass through to chart */
}
.chart-controls > * {
    pointer-events: auto; /* Re-enable clicks for buttons */
}

/* Responsive Controls */
@media (max-width: 1200px) {
    .chart-controls {
        flex-direction: column-reverse; /* Buttons on top */
        gap: 10px;
        right: 10px; /* Use full width minus padding */
    }
    .chart-controls > div {
        align-self: flex-start; /* Align to left */
    }
}

.main-logo {
    width: 140%;
    margin-left: -20%;
    margin-bottom: 10px;
}

.partner-logo {
    width: 100px;
    cursor: pointer;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.5));
    transition: all 0.1s ease;
}
.partner-logo.clicked {
    filter: none;
    transform: scale(0.95);
}

/* Cookie Banner */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #2d2d2d;
    color: #e0e0e0;
    padding: 15px 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    z-index: 1000;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.5);
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    box-sizing: border-box;
}
.cookie-banner.show {
    transform: translateY(0);
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    body {
        padding: 2px; /* Minimal padding for mobile */
    }
    .dashboard {
        flex-direction: column;
        gap: 10px;
        margin-bottom: 10px;
    }
    .chart-log-wrapper {
        gap: 10px;
    }
    .card {
        width: 100%;
        min-width: 0;
        margin-bottom: 10px;
    }
    #partners-card {
        order: 10; /* Move to bottom of dashboard */
    }
    #chart-card, #log-container {
        height: 400px !important;
        width: 100% !important;
        flex: 1 1 100%;
    }
    /* Hide decorative SVGs on mobile to save space and prevent layout issues */
    .card svg {
        display: none;
    }
    /* Reset margins for content next to SVGs */
    .qa-list {
        margin-left: 0 !important;
    }
    /* Target the div inside Registration card that has margin-right: 45px */
    .card > div[style*="margin-right: 45px"] {
        margin-right: 0 !important;
    }
    /* Adjust chart controls */
    #chart-wrapper {
        display: flex;
        flex-direction: column;
    }
    .chart-controls {
        position: relative;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        padding: 5px 0;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        background: transparent;
    }
    #chart {
        flex: 1;
        height: auto !important;
    }
    .bg-text {
        font-size: 20px !important;
    }
    .main-logo {
        width: 80% !important;
        margin-left: 0 !important;
    }
}
.cookie-btn {
    background-color: #4caf50;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: bold;
    white-space: nowrap;
    transition: background 0.2s;
}
.cookie-btn:hover {
    background-color: #45a049;
}

/* Logo Animation Labels */
.anim-label {
    font-weight: bold;
    font-size: 15px;
    color: #888;
    transition: all 0.3s ease;
}
.shimmer-red {
    color: #f44336;
    text-shadow: 0 0 10px rgba(244, 67, 54, 0.8);
}
.shimmer-green {
    color: #4caf50;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.8);
}

.logo-blink {
    animation: blink-animation 0.5s ease-in-out;
}

@keyframes blink-animation {
    0% { filter: brightness(1); }
    50% { filter: brightness(1.3) drop-shadow(0 0 5px rgba(76, 175, 80, 0.5)); }
    100% { filter: brightness(1); }
}

/* Grid Layout for Logo Card */
.logo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* Uniform columns = Squares */
    grid-template-rows: repeat(3, 1fr);    /* Uniform rows = Squares */
    gap: 0;
    width: 100%;
    height: 100%;
    padding: 0; /* Remove padding to maximize space */
    box-sizing: border-box;
}
.grid-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: visible;
    z-index: 2;
}
/* Center cell needs to clip the logo if it's scaled up */
.grid-cell.center-cell {
    z-index: 1;
    position: relative !important;
    overflow: hidden !important; /* Clip the logo to the square */
}
.grid-cell img {
    width: 20%; /* Small icons */
    height: 20%;
    object-fit: contain;
    opacity: 0; /* Completely invisible until active */
    transition: opacity 0.3s, transform 0.3s, filter 0.3s;
}
/* Ensure main logo is fully opaque and larger */
.grid-cell.center-cell img {
    position: relative;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain;
    transform: none; /* No scaling needed as image is pre-cropped */
    margin: 0 !important;
    opacity: 1 !important;
    z-index: 1;
}

#logo-card {
    flex: 0 0 auto;
    aspect-ratio: 1 / 1;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

/* Mobile Responsive Styles */
@media only screen and (max-width: 768px) {
    #logo-card {
        flex: 0 0 auto !important;
        width: 100% !important;
        max-width: 320px; /* Increased size for mobile */
        aspect-ratio: 1 / 1; /* Keep square */
        height: auto !important; /* Override JS height */
        margin: 0 auto 15px auto;
        background-color: transparent !important; /* Transparent background on mobile */
        box-shadow: none !important; /* Remove shadow on mobile */
    }
}
/* When shimmering, make icons fully visible */
.shimmer-red, .shimmer-green {
    opacity: 1 !important;
}
