/**
 * Equlix Chart Engine - Styles
 *
 * Main stylesheet for the Equlix trading chart interface.
 * Uses the Equlix brand colors and Poppins font family.
 *
 * @author Ahmed Sallemi
 * @version 1.0.0
 */

/* ============================================================================
   CSS VARIABLES - EQULIX THEME
   ============================================================================ */

:root {
    /* Brand Colors */
    --primary-purple: #684FE6;
    --primary-purple-hover: #5a43cc;
    --accent-orange: #F7931A;

    /* Background Colors */
    --bg-main: #151419;
    --bg-panel: #1E1D22;
    --bg-panel-light: #25242B;
    --bg-hover: #2A2930;

    /* Border Colors */
    --border-color: #474451;
    --border-subtle: #333238;

    /* Trading Colors */
    --color-bull: #22C55E;
    --color-bear: #EF4444;
    --color-bull-dim: rgba(34, 197, 94, 0.2);
    --color-bear-dim: rgba(239, 68, 68, 0.2);

    /* Text Colors */
    --text-primary: #FFFFFF;
    --text-secondary: #888888;
    --text-muted: #666666;

    /* Spacing */
    --header-height: 48px;
    --status-height: 28px;

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

/* ============================================================================
   RESET & BASE STYLES
   ============================================================================ */

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

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 13px;
    line-height: 1.4;
    background-color: var(--bg-main);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================================
   LAYOUT STRUCTURE
   ============================================================================ */

#app {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
}

/* ============================================================================
   HEADER BAR
   ============================================================================ */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    padding: 0 16px;
    background-color: var(--bg-panel);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, var(--primary-purple), var(--accent-orange));
    border-radius: 6px;
    font-weight: 700;
    font-size: 14px;
    color: white;
}

.logo-text {
    font-weight: 600;
    font-size: 16px;
    color: var(--text-primary);
}

/* Pair Selector */
.pair-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    background-color: var(--bg-panel-light);
    border-radius: 6px;
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.pair-selector:hover {
    background-color: var(--bg-hover);
}

.pair-name {
    font-weight: 600;
    font-size: 14px;
}

.pair-price {
    color: var(--color-bull);
    font-weight: 500;
    font-size: 13px;
    font-family: 'Roboto Mono', monospace;
}

/* Timeframe Buttons */
.timeframe-selector {
    display: flex;
    align-items: center;
    gap: 2px;
}

.tf-group {
    display: flex;
    gap: 2px;
}

.tf-divider {
    width: 1px;
    height: 20px;
    background-color: var(--border-subtle);
    margin: 0 6px;
}

.tf-btn {
    padding: 4px 8px;
    background-color: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 32px;
    text-align: center;
}

.tf-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.tf-btn.active {
    background-color: var(--primary-purple);
    border-color: var(--primary-purple);
    color: var(--text-primary);
}

/* Chart Type Buttons */
.chart-type-selector {
    display: flex;
    gap: 4px;
    margin-left: 8px;
    padding-left: 16px;
    border-left: 1px solid var(--border-subtle);
}

.type-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background-color: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.type-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text-primary);
}

.type-btn.active {
    background-color: var(--primary-purple);
    border-color: var(--primary-purple);
    color: var(--text-primary);
}

.type-btn svg {
    width: 16px;
    height: 16px;
}

/* ============================================================================
   CHART CONTAINER
   ============================================================================ */

.chart-container {
    flex: 1;
    position: relative;
    min-height: 0;
    overflow: hidden;
}

#chart-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;
}

/* ============================================================================
   STATUS BAR
   ============================================================================ */

.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--status-height);
    padding: 0 12px;
    background-color: var(--bg-panel);
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.status-left,
.status-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
}

.status-label {
    color: var(--text-muted);
}

.status-value {
    color: var(--text-secondary);
    font-weight: 500;
    font-family: 'Roboto Mono', monospace;
}

.status-hint {
    font-size: 11px;
    color: var(--text-muted);
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

/* Price colors */
.price-up {
    color: var(--color-bull) !important;
}

.price-down {
    color: var(--color-bear) !important;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-panel);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Selection color */
::selection {
    background-color: var(--primary-purple);
    color: white;
}

/* Focus styles for accessibility */
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--primary-purple);
    outline-offset: 2px;
}

/* ============================================================================
   RESPONSIVE ADJUSTMENTS
   ============================================================================ */

@media (max-width: 1200px) {
    /* Hide seconds group on medium screens */
    .tf-group:first-child {
        display: none;
    }

    .tf-divider:first-of-type {
        display: none;
    }
}

@media (max-width: 900px) {
    /* Also hide hours group on smaller screens */
    .tf-group:nth-child(5) {
        display: none;
    }

    .tf-divider:nth-of-type(3) {
        display: none;
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 12px;
    }

    .header-left,
    .header-right {
        gap: 12px;
    }

    .logo-text {
        display: none;
    }

    .pair-selector {
        padding: 4px 8px;
    }

    .tf-btn {
        padding: 3px 6px;
        font-size: 10px;
        min-width: 28px;
    }

    .tf-divider {
        margin: 0 4px;
    }

    .chart-type-selector {
        margin-left: 4px;
        padding-left: 12px;
    }

    .type-btn {
        width: 28px;
        height: 28px;
    }

    .status-item {
        font-size: 10px;
    }

    .status-hint {
        display: none;
    }
}

@media (max-width: 600px) {
    /* Show only main timeframes on small screens */
    .tf-group {
        display: none;
    }

    .tf-divider {
        display: none;
    }

    /* Show only minutes and D/W/M groups */
    .tf-group:nth-child(3),
    .tf-group:nth-child(7) {
        display: flex;
    }

    .tf-divider:nth-of-type(2) {
        display: block;
    }
}

@media (max-width: 480px) {
    .timeframe-selector {
        display: none;
    }

    .chart-type-selector {
        border-left: none;
        margin-left: 0;
        padding-left: 0;
    }
}
