
/* ============================================================
   BATTLECOUNCIL TRACKER
   Main Stylesheet
   ============================================================ */

/* ============================================================
   BASE
   ============================================================ */

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    min-height: 100%;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #1f2933;
    color: #e5e7eb;
}

a {
    color: inherit;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 30px auto;
}


/* ============================================================
   HEADER
   ============================================================ */

header {
    text-align: center;
    padding: 20px 0;
}

header h1 {
    margin: 0;
    color: #c9a227;
}


/* ============================================================
   GENERAL CARDS
   ============================================================ */

.card,
.bc-card {
    background: #273746;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}

h2 {
    text-align: center;
    margin-top: 0;
    color: #ffffff;
}


/* ============================================================
   PAGE / TRACKER HEADER
   ============================================================ */

.tracker-header {
    text-align: center;
    padding: 20px;
    margin-bottom: 20px;
}

.tracker-header h2 {
    margin-bottom: 8px;
}

.tracker-header p {
    margin: 0;
    color: #9ca3af;
}


/* ============================================================
   HOME / MODULE INTRO
   ============================================================ */

.tracker-hero {
    text-align: center;
    margin: 25px 0 30px;
}

.tracker-hero h1 {
    margin: 0 0 8px;
    color: #c9a227;
}

.tracker-hero p {
    margin: 0;
    color: #9ca3af;
}


/* ============================================================
   MODULE CARD GRID
   ============================================================ 

.module-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    width: 100%;
    margin: 0 0 24px;
}
*/

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, 300px);
    gap: 20px;
    justify-content: center;
}


/* ============================================================
   MODULE CARDS
   ============================================================ */

.module-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
    background: #273746;
    border: 1px solid #465563;
    border-radius: 10px;
    box-shadow: 0 3px 12px rgba(0, 0, 0, .25);
    text-decoration: none;
    color: inherit;
    transition:
        transform .18s ease,
        box-shadow .18s ease,
        border-color .18s ease;
}

.module-card:hover {
    transform: translateY(-3px);
    border-color: #c9a227;
    box-shadow: 0 8px 22px rgba(0, 0, 0, .35);
}


/* ============================================================
   MODULE IMAGES
   ============================================================ */

.module-image {
    width: 100%;
    height: 250px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    flex-shrink: 0;
    background: #151b21;
}

.module-image img {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    object-fit: cover;
}


/* ============================================================
   MODULE CONTENT
   ============================================================ */

.module-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
    padding: 20px;
}

.module-content h2 {
    margin: 0 0 8px;
    text-align: left;
}

.module-content p {
    margin: 0 0 16px;
    color: #b8c0c8;
    line-height: 1.5;
}

.module-link {
    display: block;
    margin-top: auto;
    color: #c9a227;
    font-weight: bold;
}


/* ============================================================
   METRIC CARDS
   ============================================================ */

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.metric-card {
    background: #273746;
    border: 1px solid #465563;
    border-radius: 8px;
    padding: 18px;
    text-align: center;
}

.metric-card h3 {
    margin: 0 0 10px;
    color: #9ca3af;
    font-size: .85rem;
    text-transform: uppercase;
}

.metric-card span {
    color: #c9a227;
    font-size: 1.4rem;
    font-weight: bold;
}


/* ============================================================
   BUTTONS
   ============================================================ */

.btn-launch,
.bc-button {
    display: inline-block;
    border: 0;
    border-radius: 6px;
    background: #c9a227;
    color: #1f2933;
    font-weight: bold;
    cursor: pointer;
    transition:
        opacity .15s ease,
        transform .15s ease;
}

.btn-launch {
    padding: 12px 25px;
    font-size: 1rem;
}

.bc-button {
    height: 38px;
    padding: 0 16px;
    font-size: 14px;
}

.btn-launch:hover,
.bc-button:hover:not(:disabled) {
    opacity: .85;
    transform: translateY(-1px);
}

.bc-button:disabled {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

.tracker-actions {
    text-align: center;
    margin-bottom: 20px;
}


/* ============================================================
   AUTOMATION CONTROLS
   ============================================================ */

.automation-control {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    margin-top: auto;
    padding-top: 18px;
}

.automation-control label {
    display: block;
    margin: 0 0 5px;
    color: #9ca3af;
    font-size: 13px;
    font-weight: 600;
}

.automation-control input {
    width: 80px;
    height: 38px;
    padding: 7px 10px;
    border: 1px solid #465563;
    border-radius: 5px;
    background: #1f2933;
    color: #e5e7eb;
    font-size: 14px;
}


/* ============================================================
   AUTOMATION STATUS
   ============================================================ */

.automation-status, .footer-status {
    margin: 20px auto 24px;
    padding: 22px;
}

.status-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.status-header h2 {
    margin: 0;
    text-align: left;
}

.status-indicator {
    color: #9ca3af;
    font-size: 14px;
    font-weight: 600;
}

.progress-area {
    margin-top: 20px;
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 7px;
    color: #9ca3af;
    font-size: 13px;
}

.progress-bar {
    width: 100%;
    height: 12px;
    overflow: hidden;
    background: #151b21;
    border-radius: 10px;
}

.progress-fill {
    width: 0;
    height: 100%;
    background: #c9a227;
    transition: width .25s ease;
}

.automation-actions {
    margin-top: 18px;
    text-align: right;
}

.stop-button {
    background: #6b7280;
    color: #fff;
}

.stop-button:hover:not(:disabled) {
    background: #555b64;
}


/* ============================================================
   DATA TABLE
   ============================================================ */

.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
}

.data-table th {
    padding: 10px;
    background: #c9a227;
    color: #1f2933;
    text-align: left;
}

.data-table td {
    padding: 10px;
    border-bottom: 1px solid #465563;
}

.data-table tbody tr:hover {
    background: #34495e;
}


/* ============================================================
   FOOTER
   ============================================================ */

.footer {
    margin-top: 30px;
    padding: 15px 20px;
    background: #252b33;
    color: #9ca3af;
    text-align: center;
    border-radius: 8px;
}

.footer-inner {
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer-left {
    color: #9ca3af;
    font-size: .85rem;
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 900px) {

    .metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

}

@media (max-width: 700px) {

    .container {
        width: 94%;
        margin: 20px auto;
    }

    .module-grid {
        grid-template-columns: 1fr;
    }

    .module-image {
        height: 220px;
    }

    .automation-control {
        flex-wrap: wrap;
    }

    .status-header {
        align-items: flex-start;
        flex-direction: column;
    }

}

@media (max-width: 500px) {

    .metric-grid {
        grid-template-columns: 1fr;
    }

}

/* ============================================================
   NAVIGATION
   ============================================================ */

.main-nav {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 25px;
    background: #000;
    padding: 10px 25px;
}

.main-nav a {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
}


/* ============================================================
   TRACKER DROPDOWNS
   ============================================================ */

.tracker-clan-select,
.form-control {
    min-width: 180px;
    height: 38px;
    padding: 6px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: #fff;
    color: #333;
    font-size: 14px;
    cursor: pointer;
}

.tracker-clan-select:hover,
.form-control:hover {
    border-color: #999;
}

.tracker-clan-select:focus,
.form-control:focus {
    outline: none;
    border-color: #666;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, .08);
}


/* ============================================================
   CHEST TRACKER CONTROLS
   ============================================================ */

.controls-div {
    display: flex;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 20px;
}

.control-clan,
.control-user,
.control-timeframe {
    flex: 1;
}

.control-launcher {
    margin-left: auto;
}

.controls-div .bc-card {
    height: 100%;
}

.controls-div form {
    margin: 0;
}

.controls-div .form-control {
    width: 100%;
}

.control-timeframe .form-control:disabled {
    cursor: not-allowed;
    opacity: .65;
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 900px) {

    .controls-div {
        flex-wrap: wrap;
    }

    .control-clan,
    .control-user,
    .control-timeframe {
        flex: 1 1 30%;
    }

    .control-launcher {
        flex: 1 1 100%;
        margin-left: 0;
    }

}

/* pie chart rows */

/* ============================================================
   CHEST CHART GRID
   ============================================================ */

.chest-chart-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.chest-chart-grid > .bc-card {
    min-width: 0;
    min-height: 0;
}

.chest-chart-grid h3 {
    margin: 0 0 12px;
    color: #fff;
    text-align: center;
}

.chest-piechart {
    grid-column: 3;
    grid-row: 1 / 3;
    text-align: center;
}

.chest-piechart .form-control {
    width: 80%;
    max-width: 300px;
    margin: 0 auto;
}

#chestPieChart {
    min-height: 0;
    height: calc(100% - 35px);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
}

.chest-chart-grid .metric-card {
    padding: 10px;
}

@media (max-width: 900px) {

    .chest-chart-grid {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }

    .chest-piechart {
        grid-column: 1 / 3;
        grid-row: auto;
        text-align: center;
    }

    .chest-piechart .form-control {
        width: 80%;
        max-width: 300px;
        margin: 0 auto;
    }

}

@media (max-width: 600px) {

    .chest-chart-grid {
        grid-template-columns: 1fr;
    }

    .chest-piechart {
        grid-column: auto;
        grid-row: auto;
        text-align: center;
    }

    .chest-piechart .form-control {
        width: 80%;
        max-width: 300px;
        margin: 0 auto;
    }

}

/* new row 2 - piechart */ 
/* ============================================================
   CHEST TRACKER CONTROLS
   ============================================================ */

.controls-div {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.control-clan,
.control-user,
.control-timeframe {
    min-width: 0;
}

.controls-div .bc-card {
    height: 100%;
}

.controls-div form {
    margin: 0;
}

.controls-div .form-control {
    width: 100%;
    box-sizing: border-box;
}

.control-timeframe .form-control:disabled {
    cursor: not-allowed;
    opacity: .65;
}


/* ============================================================
   CHEST CLAN / USER / PIE SECTION
   ============================================================ */

.chest-clan-info {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
    align-items: stretch;
}

.chest-clan-info > .bc-card {
    min-width: 0;
    min-height: 0;
}


/* Clan statistics */

.chest-clan-info > .bc-card:nth-child(1) {
    grid-column: 1;
    grid-row: 1 / 3;
}


/* User statistics */

.chest-clan-info > .bc-card:nth-child(2) {
    grid-column: 2;
    grid-row: 1 / 3;
}


/* Pie chart */

.chest-clan-info .chest-piechart {
    grid-column: 3;
    grid-row: 1 / 3;

    display: flex;
    flex-direction: column;
    align-items: center;
}


/* ============================================================
   INNER STAT CARDS
   ============================================================ */

.chest-clan-info > .bc-card > .bc-card {
    height: 100%;
}

.chest-clan-info .metric-grid {
    grid-template-columns: 1fr 1fr;
}


/* ============================================================
   PIE CHART
   ============================================================ */

.chest-piechart {
    text-align: center;
}

.chest-piechart #chestPieChart {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
}

.piechard-dropdown {
    width: 80%;
    max-width: 300px;
    margin-top: 15px;
}

.piechard-dropdown h3 {
    margin: 0 0 8px;
}

.piechard-dropdown .form-control {
    width: 100%;
}


/* ============================================================
   MOBILE
   ============================================================ */

@media (max-width: 900px) {

    .controls-div {
        grid-template-columns: 1fr 1fr;
    }

    .control-timeframe {
        grid-column: 1 / 3;
    }

    .chest-clan-info {
        grid-template-columns: 1fr 1fr;
        grid-template-rows: auto;
    }

    .chest-clan-info > .bc-card:nth-child(1),
    .chest-clan-info > .bc-card:nth-child(2),
    .chest-clan-info .chest-piechart {
        grid-column: auto;
        grid-row: auto;
    }

}

@media (max-width: 600px) {

    .controls-div {
        grid-template-columns: 1fr;
    }

    .control-timeframe {
        grid-column: auto;
    }

    .chest-clan-info {
        grid-template-columns: 1fr;
    }

}

/* ============================================================
   CHEST TYPE PILLS
   ============================================================ */

.control-chest-pills {
    grid-column: 1 / -1;
    width: 100%;
    margin-bottom: 20px;
}

.control-chest-pills .bc-card {
    width: 100%;
}

.chest-pills {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.chest-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 20px;
    background: #34495e;
    border: 1px solid #465563;
    color: #e5e7eb;
    font-size: 14px;
    font-weight: 600;
}

.chest-pill strong {
    color: #c9a227;
    font-size: 13px;
}

/* pie chart dropdowns */
/* ============================================================
   PIE CHART HEADER
   ============================================================ */

.piechart-header {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    width: 100%;
    margin-bottom: 15px;
}

.piechart-dropdown,
.piechart-timeframe {
    width: 50%;
    max-width: 180px;
}

.piechart-dropdown .form-control,
.piechart-timeframe .form-control {
    width: 100%;
    box-sizing: border-box;
}

.piechart-timeframe .bc-card {
    padding: 0;
    background: transparent;
    box-shadow: none;
}

@media (max-width: 600px) {

    .piechart-header {
        flex-direction: column;
    }

    .piechart-dropdown,
    .piechart-timeframe {
        width: 100%;
        max-width: 220px;
    }

}

/* piechart */ 
.chest-piechart {
    min-height: 450px;
}

#chestPieChart {
    position: relative;
    height: 350px;
}

#chestPieChartCanvas {
    width: 100% !important;
    height: 100% !important;
}

.chest-empty-image {
    display: block;
    width: 250px;
    height: 250px;
    margin: 0 auto;
    object-fit: contain;
}

/* ==========================================================
   DETAIL TABS
   ========================================================== */

.detail-tabs {
    display: flex;
    width: 100%;
    margin: 0;
    padding: 0;
    border-bottom: 2px solid #c9a227;
}

.detail-tab {
    padding: 10px 16px;
    margin: 0;
    border: none;
    border-right: 1px solid #465563;
    background: #465563;
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.detail-tab:first-child {
    border-left: none;
}

.detail-tab:hover {
    background: #34495e;
}

.detail-tab.active {
    background: #c9a227;
    color: #1f2933;
}

.detail-tab-content {
    display: none;
}

.detail-tab-content.active {
    display: block;
}

/* ==========================================================
   CHEST STATUS DOTS
   ========================================================== */

.chest-status-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    vertical-align: middle;
}

.chest-status-dot.green {
    background: #2ecc71;
}

.chest-status-dot.yellow {
    background: #f1c40f;
}

.chest-status-dot.red {
    background: #e74c3c;
}