/**
 * PDS Chart.js Styles
 * Professional stock chart styling with exact design match
 */

/* Main Container with Transparent Background */
.pds-highcharts-container {
    background: transparent;
    border-radius: 12px;
    padding: 32px 24px 32px 24px;
    margin-left: -35px;
    position: relative;
    width: calc(100% + 35px);
    min-height: 500px;
    overflow: hidden;
    font-family: 'nexaregular', 'Inter', 'Poppins', sans-serif;
    box-shadow: none;
}

/* Chart Wrapper - Completely transparent, no padding */
.pds-chart-wrapper {
    position: relative;
    width: 100%;
    height: 420px;
    background: transparent !important;
    border-radius: 0;
    border: none !important;
    padding: -5px !important;
    margin: -5px !important;
    box-shadow: none;
}

/* Responsive Chart Container */
#pds-stock-chart {
    width: 100%;
    height: 420px;
    position: relative;
    overflow: hidden;
}

/* Small Mobile Responsive Styles */
@media (max-width: 360px) {
    .pds-highcharts-container {
        padding: 12px;
        margin-left: 0;
        width: 100%;
        min-height: 350px;
    }
    
    .pds-chart-wrapper,
    #pds-stock-chart {
        height: 300px;
    }
    
    /* Ensure chart canvas is responsive */
    #pds-chart-canvas {
        width: 100% !important;
        height: 100% !important;
    }
}

/* Mobile Responsive Styles */
@media (min-width: 361px) and (max-width: 480px) {
    .pds-highcharts-container {
        padding: 16px;
        margin-left: 0;
        width: 100%;
        min-height: 380px;
    }
    
    .pds-chart-wrapper,
    #pds-stock-chart {
        height: 320px;
    }
    
    /* Ensure chart canvas is responsive */
    #pds-chart-canvas {
        width: 100% !important;
        height: 100% !important;
    }
}

/* Tablet Responsive Styles */
@media (min-width: 481px) and (max-width: 768px) {
    .pds-highcharts-container {
        padding: 20px;
        margin-left: 0;
        width: 100%;
        min-height: 420px;
    }
    
    .pds-chart-wrapper,
    #pds-stock-chart {
        height: 360px;
    }
}

/* Chart Container - Completely transparent, no borders, no padding */

/* Chart Canvas */
#pds-chart-canvas {
    width: 100% !important;
    height: 420px !important;
    background: transparent !important;
    border-radius: 0;
    border: none !important;
    padding: -5px !important;
    margin: -5px !important;
    box-sizing: border-box !important;
    font-family: 'nexaregular', 'Inter', 'Poppins', sans-serif !important;
}

/* X-axis labels positioning - move to the right */
#pds-stock-chart canvas {
    transform: translateX(15px);
}

/* Time Range Buttons - Exact Design Match */
.time-range-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    justify-content: flex-start;
    align-items: center;
}

.time-range-buttons button {
    padding: 8px 55px;
    border: none;
    background: #EEEFF1;
    border-radius: 9999px;
    font-family: 'Inter', 'Poppins', sans-serif;
    font-size: 12px;
    color: #2E2E2E;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 85px;
    font-weight: 400;
    position: relative;
    overflow: hidden;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.time-range-buttons button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.time-range-buttons button:hover::before {
    left: 100%;
}

.time-range-buttons button:hover {
    background: #E0E0E0;
    transform: translateY(-2px);
}

.time-range-buttons button:active {
    transform: translateY(0);
}

.time-range-buttons button.time-active-range {
    background: #FFFFFF;
    color: #2E2E2E;
    font-weight: 400;
    transform: translateY(-1px);
    text-align: center;
}

.time-range-buttons button.time-active-range:hover {
    background: #F8F9FA;
    transform: translateY(-2px);
}

/* Stock Information Section - Exact Design Match */
.share-price-left {
    flex: 0 0 21%;
    padding-right: 20px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding-top: 8px;
}

.share-price-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

/* Main layout container */
.share-price-container {
    display: flex;
    gap: 24px;
    align-items: flex-start;
    padding: 0 8px;
}

/* Typography Styles - Exact Match to Design */
.stock-title {
    font-weight: 900;
    font-size: 24px;
    color: #1A1A1A;
    margin-bottom: 25px;
    line-height: 1.4;
    letter-spacing: -0.5px;
}

.stock-label {
    font-weight: 900;
    font-size: 22px;
    color: #1A1A1A;
    margin-bottom: 8px;
    line-height: 1.4;
    letter-spacing: -0.2px;
}

.stock-value {
    font-weight: 100;
    font-size: 20px;
    color: #1A1A1A;
    margin-bottom: 20px;
    line-height: 1.4;
    font-family: 'Inter', sans-serif;
}

/* Footer Text - Exact Design Match */
.chart-footer {
    text-align: left;
    margin-top: 20px;
    font-size: 13px;
    color: #9AA0A6;
    font-family: 'Inter', 'Poppins', sans-serif;
    font-weight: 400;
    line-height: 1.5;
    opacity: 0.8;
}

/* Mobile Responsive Design */
@media (max-width: 768px) {
    .pds-highcharts-container {
        padding: 0;
        min-height: 300px;
        width: 100%;
        margin: 0;
    }
    
    .share-price-container {
        flex-direction: column;
        gap: 20px;
        padding: 0 4px;
    }
    
    .share-price-left {
        flex: none;
        padding-right: 0;
        text-align: center;
    }
    
    .share-price-right {
        order: 2;
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 100%;
    }
    
    /* Mobile Title - Centered */
    .stock-title {
        font-size: 28px;
        font-weight: 900;
        color: #1A1A1A;
        margin-bottom: 30px;
        text-align: center;
        line-height: 1.3;
    }
    
    /* Stock Columns - Extreme Left and Right */
    .stock-columns {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
        gap: 0;
        max-width: 100%;
        margin: 0 auto;
        padding: 0 20px;
        width: 100%;
    }
    
    .stock-column {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        flex: 0 0 auto;
    }
    
    /* First column (BSE) - Extreme Left */
    .stock-column:first-child {
        align-items: flex-start;
        text-align: left;
    }
    
    /* Second column (NE) - Extreme Right */
    .stock-column:last-child {
        align-items: flex-end;
        text-align: right;
    }
    
    .stock-label {
        font-size: 22px;
        font-weight: 900;
        color: #1A1A1A;
        margin-bottom: 8px;
        line-height: 1.2;
        white-space: nowrap;
        min-width: 80px;
        text-align: center;
    }
    
    .stock-value {
        font-size: 24px;
        font-weight: 300;
        color: #1A1A1A;
        margin-bottom: 0;
        line-height: 1.2;
    }
    
    /* Mobile Time Range Buttons - Single Line */
    .time-range-buttons {
        display: flex;
        gap: 4px;
        margin-bottom: 12px;
        justify-content: flex-start !important;
        flex-wrap: nowrap;
        width: 100%;
        overflow: visible !important;
        padding: 0 5px 0 15px;
    }
    
    .time-range-buttons button,
    .time-range-buttons button.time-active-range {
        padding: 5px 8px !important;
        font-size: 9px !important;
        min-width: 20px !important;
        flex-shrink: 0 !important;
        white-space: nowrap !important;
        border: none !important;
        background: #EEEFF1 !important;
        border-radius: 9999px !important;
        font-family: 'Inter', 'Poppins', sans-serif !important;
        color: #2E2E2E !important;
        cursor: pointer !important;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        font-weight: 400 !important;
        position: relative !important;
        overflow: hidden !important;
        text-align: center !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        width: auto !important;
        max-width: none !important;
    }
    
    /* Mobile Chart Container - 10:8 Ratio - Bigger */
    .pds-chart-wrapper {
        height: 90vw !important;
        max-height: 400px !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
    }
    
    #pds-stock-chart {
        height: 90vw !important;
        max-height: 400px !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
    }
    
    #pds-chart-canvas {
        width: 100% !important;
        height: 90vw !important;
        max-height: 400px !important;
    }
    
    /* Remove chart internal padding for mobile */
    .pds-highcharts-container {
        padding: 0 5px 0 0 !important;
        margin: 0 !important;
        width: 100% !important;
        margin-left: -20px !important;
        width: calc(100% + 15px) !important;
    }
}

/* Very Small Mobile - Extra Small Screens */
@media (max-width: 480px) {
    .share-price-container {
        gap: 16px;
        padding: 0 2px;
    }
    
    .stock-title {
        font-size: 26px;
        margin-bottom: 24px;
    }
    
    .stock-columns {
        gap: 0;
        max-width: 100%;
        padding: 0 15px;
        width: 100%;
    }
    
    .stock-label {
        font-size: 20px;
        white-space: nowrap;
        min-width: 70px;
    }
    
    .stock-value {
        font-size: 22px;
    }
    
    .time-range-buttons button,
    .time-range-buttons button.time-active-range {
        padding: 4px 40px !important;
        font-size: 8px !important;
        min-width: 30px !important;
        border: none !important;
        background: #EEEFF1 !important;
        border-radius: 9999px !important;
        font-family: 'Inter', 'Poppins', sans-serif !important;
        color: #2E2E2E !important;
        cursor: pointer !important;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
        font-weight: 400 !important;
        position: relative !important;
        overflow: hidden !important;
        text-align: center !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .pds-chart-wrapper {
        height: 90vw !important;
        max-height: 360px !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
    }
    
    #pds-stock-chart {
        height: 90vw !important;
        max-height: 360px !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow: visible !important;
    }
    
    #pds-chart-canvas {
        width: 100% !important;
        height: 90vw !important;
        max-height: 360px !important;
    }
    
    /* Remove chart internal padding for small mobile */
    .pds-highcharts-container {
        padding: 0 5px 0 0 !important;
        margin: 0 !important;
        width: 100% !important;
        margin-left: -20px !important;
        width: calc(100% + 15px) !important;
    }
}

/* Chart Error State */
.chart-error {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 370px;
    color: #d32f2f;
    font-family: 'Arial', sans-serif;
    font-size: 16px;
    text-align: center;
    padding: 20px;
    background: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 4px;
}

/* Loading State */
.chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 370px;
    color: #666;
    font-family: 'Arial', sans-serif;
    font-size: 16px;
    text-align: center;
}

/* Custom Loading Overlay */
.pds-chart-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 12px;
    transition: opacity 0.3s ease-in-out;
}

.pds-chart-loading-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Loading Spinner */
.pds-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #FF3448;
    border-radius: 50%;
    animation: pds-spin 1s linear infinite;
    margin-bottom: 16px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
}

@keyframes pds-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Loading Text */
.pds-loading-text {
    font-family: 'nexaregular', 'Inter', 'Poppins', sans-serif;
    font-size: 14px;
    color: #333;
    font-weight: 500;
    text-align: center;
    margin: 0;
    background: rgba(255, 255, 255, 0.8);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Disable chart interaction during loading */
.pds-chart-wrapper.loading {
    pointer-events: none;
    position: relative;
}

.pds-chart-wrapper.loading canvas {
    opacity: 0.3;
    transition: opacity 0.3s ease-in-out;
}

/* Mobile responsive loading styles */
@media (max-width: 768px) {
    .pds-chart-loading-overlay {
        border-radius: 8px;
    }
    
    .pds-loading-spinner {
        width: 32px;
        height: 32px;
        border-width: 2px;
        margin-bottom: 12px;
    }
    
    .pds-loading-text {
        font-size: 13px;
        padding: 6px 12px;
    }
}

@media (max-width: 480px) {
    .pds-loading-spinner {
        width: 28px;
        height: 28px;
        margin-bottom: 10px;
    }
    
    .pds-loading-text {
        font-size: 12px;
        padding: 5px 10px;
    }
}

/* Current Price Indicator */
.current-price-indicator {
    position: absolute;
    z-index: 10;
    pointer-events: none;
}

.price-box {
    background: #202954;
    color: white;
    padding: 3px 5px;
    border-radius: 4px;
    font-family: 'nexaregular', 'Inter', 'Poppins', sans-serif;
    font-size: 12px;
    font-weight: 400;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    min-width: 60px;
    text-align: center;
}

.current-price-value {
    color: white;
    font-weight: 600;
}
