.idex-plugin-ctn {
    font-family: 'Open Sans', Arial, sans-serif;
    color: #333;
    width: 100%;
}

.idex-plugin-ctn .idex-nav {
    display: flex;
    align-items: center;
    padding: 18px 0 0 0;
    border-bottom: 1px solid #e5e8ec;
    background: transparent;
    gap: 0;
    margin-bottom: 20px;
}

.idex-plugin-ctn .idex-nav a {
    text-decoration: none;
    color: #555;
    font-size: 15px;
    font-weight: 400;
    padding-bottom: 14px;
    white-space: nowrap;
    transition: color 0.2s;
    box-shadow: none;
}

.idex-plugin-ctn .idex-nav a:hover {
    color: #1a6496;
}

.idex-plugin-ctn .idex-nav a.active {
    color: #1a6496;
    font-weight: 700;
    border-bottom: 3px solid #1a6496;
}

.idex-plugin-ctn .idex-nav .nav-divider {
    color: #ccc;
    font-size: 18px;
    padding: 0 16px;
    padding-bottom: 14px;
    user-select: none;
    line-height: 1;
}

.idex-plugin-ctn .idex-panel {
    display: none;
}

.idex-plugin-ctn .idex-panel.active {
    display: block;
}

.idex-plugin-ctn .graph-panel {
    display: flex;
    align-items: stretch;
    padding: 0;
    min-height: 400px;
    gap: 20px;
}

.idex-plugin-ctn .graph-area {
    flex: 1 1 0;
    min-width: 0;
    position: relative;
    padding: 24px 0 0 0;
    /* Reduced bottom padding */
}

.idex-plugin-ctn .chart-wrapper {
    width: 100%;
    height: 320px;
    /* Defined height for desktop */
    position: relative;
}

.idex-plugin-ctn .idex-graph-link-wrapper {
    display: block;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
    border-radius: 8px;
}

.idex-plugin-ctn .idex-graph-link-wrapper:hover {
    background-color: rgba(42, 122, 173, 0.03);
}

.idex-plugin-ctn .idex-graph-link-wrapper:hover .graph-side-info p {
    color: #1a6496;
}

.idex-plugin-ctn .graph-side-info {
    width: 210px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    /* Align top */
    padding: 40px 0 0 0;
    /* Align with graph top */
    gap: 15px;
}

.idex-plugin-ctn .graph-side-info p {
    font-size: 12.5px;
    line-height: 1.6;
    color: #2a7aad;
    margin-top: 0;
    margin-bottom: 5px;
}

/* ============================================================
   CALCULATOR STYLING
   ============================================================ */
.calc-panel {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: normal;
    gap: 15px;
}

.calc-row {
    margin-bottom: 5px;
    text-align: start;
}

.calc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
    margin-bottom: 5px;
}

.calc-btn {
    padding: 2px 5px;
    border: 1px solid #c8d6e0;
    border-radius: 8px;
    background: #f7f9fb;
    color: #1a6496;
    font-size: 14px;
    cursor: pointer;
    transition: all .2s;
}

.calc-btn:hover {
    color: #1a6496;
    background: #e8f0f6;
}

.calc-btn.active {
    background: #1a6496;
    color: white;
    border-color: #1a6496;
}

.calc-result {
    margin-top: 25px;
    font-size: 26px;
    color: #1a6496;
    font-weight: bold;
    text-align: center;
}

/* ============================================================
   BUTTONS WIDGET STYLING
   ============================================================ */
.button-result {
    text-align: center;
}

.idex-plugin-ctn .idex-link-btn {
    display: inline-block;
    padding: 10px 20px;
    border: 0;
    border-radius: 100px;
    background-color: #29abe2;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    text-decoration: none;
    line-height: 1.4;
    width: 130px !important;
}

.idex-plugin-ctn .idex-link-btn:hover {
    background-color: #002331;
    text-decoration: none;
    color: white;
}

.idex-plugin-ctn .idex-link-btn:active {
    transform: translateY(1px);
}

/* ============================================================
   PRICE BADGE
   ============================================================ */
.idex-plugin-ctn .price-badge {
    position: absolute;
    top: 0;
    right: 20px;
    background: #fff;
    border: 1px solid #cdd4db;
    border-radius: 4px;
    padding: 4px 12px;
    font-size: 16px;
    font-weight: 700;
    color: #222;
    display: flex;
    align-items: center;
    gap: 5px;
    z-index: 10;
    white-space: nowrap;
}

.idex-plugin-ctn .price-badge .arrow-up {
    color: #2ecc40;
    font-size: 12px;
}

.idex-plugin-ctn .price-badge .arrow-down {
    color: #e74c3c;
    font-size: 12px;
}

.idex-plugin-ctn .price-badge .change {
    font-size: 14px;
    font-weight: 700;
}

.idex-plugin-ctn .price-badge .change.up {
    color: #2ecc40;
}

.idex-plugin-ctn .price-badge .change.down {
    color: #e74c3c;
}

.idex-plugin-ctn .table-panel {
    padding: 0;
    position: relative;
    overflow: hidden;
}

.idex-plugin-ctn .watermark-stamp {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%) rotate(-15deg);
    width: 150px;
    height: 150px;
    opacity: 0.05;
    pointer-events: none;
    z-index: 0;
}

.idex-plugin-ctn .transactions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    position: relative;
    z-index: 1;
    border: none;
    table-layout: auto;
    /* Allow browser to distribute space */
}

/* Optimize column widths for narrow containers */
.idex-plugin-ctn .transactions-table td.diamond-col {
    text-align: left;
    word-break: break-word;
    /* Wrap long diamond names */
}

.idex-plugin-ctn .transactions-table td.price-col {
    white-space: nowrap;
    width: 80px;
}

.idex-plugin-ctn .transactions-table td.flag-col {
    width: 45px;
}

.idex-plugin-ctn .transactions-table thead tr {
    background: #2e7da6;
}

.idex-plugin-ctn .transactions-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background: #2e7da6;
}

.idex-plugin-ctn .transactions-table thead th {
    color: #ffffff;
    font-weight: 600;
    padding: 12px 10px;
    text-align: center;
    border: none;
}

.idex-plugin-ctn .transactions-table tbody tr {
    border-bottom: 1px solid #eee;
}

.idex-plugin-ctn .transactions-table tbody tr:last-child {
    border-bottom: none;
}

.idex-plugin-ctn .transactions-table tbody td {
    padding: 10px;
    text-align: center;
    color: #444;
    vertical-align: middle;
    border: none;
}

.idex-plugin-ctn .transactions-table tbody td.price-col {
    color: #222;
    font-weight: 600;
}

.idex-plugin-ctn .flag-img,
.idex-plugin-ctn .flag-empty {
    width: 30px;
    height: 20px;
    object-fit: cover;
    border-radius: 1px;
    display: inline-block;
    vertical-align: middle;
    border: 1px solid #eee;
}

.idex-plugin-ctn .flag-empty {
    background: #f5f5f5;
}

.idex-plugin-ctn .chart-loading,
.idex-plugin-ctn .table-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 0;
    color: #2a7aad;
    font-size: 14px;
}

.idex-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #d0e6f4;
    border-top-color: #2a7aad;
    border-radius: 50%;
    animation: idex-spin 0.8s linear infinite;
}

@keyframes idex-spin {
    to {
        transform: rotate(360deg);
    }
}

.idex-plugin-ctn .chart-error,
.idex-plugin-ctn .table-error {
    padding: 20px;
    background: #fffafa;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    color: #9b2335;
    font-size: 13px;
    text-align: center;
    margin: 10px 0;
}

.idex-plugin-ctn {
    container-type: inline-size;
    container-name: idex-widget;
}

@container idex-widget (max-width: 800px) {
    .idex-plugin-ctn .graph-panel {
        flex-direction: column;
        min-height: auto;
    }

    .idex-plugin-ctn .graph-side-info {
        width: 100%;
        order: 2;
        padding: 0 0 10px 0;
    }

    .idex-plugin-ctn .graph-area {
        order: 1;
        padding: 0;
    }

    .idex-plugin-ctn .chart-wrapper {
        height: 240px;
    }

    .idex-plugin-ctn .price-badge {
        position: relative;
        top: 0;
        right: 0;
        margin-bottom: 10px;
        display: inline-flex;
    }

    .idex-plugin-ctn .idex-nav {
        flex-wrap: wrap;
    }

    .idex-plugin-ctn .idex-nav a {
        font-size: 13px;
        padding-bottom: 10px;
    }

    .idex-plugin-ctn .idex-nav .nav-divider {
        font-size: 14px;
        padding: 0 8px 10px;
    }
}

.idex-view-table .table-panel {
    max-height: 280px;
    overflow-y: auto;
    overflow-x: hidden;
    /* Prevent horizontal scroll, depend on fluid table */
    border: 1px solid #eee;
}

.idex-plugin-ctn .table-panel {
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.idex-plugin-ctn .transactions-table {
    min-width: 0;
    /* Clear any previous min-width */
}
