/* --- 2015 BOOTSTRAP-STYLE UI --- */
body { 
    background-color: #f1f2f6; 
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 
    color: #333333; 
    margin: 0; 
    display: flex; 
    align-items: center;
    justify-content: center;
    min-height: 100vh; 
    padding: 20px;
    box-sizing: border-box;
    transition: background-color 0.3s, color 0.3s;
}

/* --- THEME TOGGLE STYLES --- */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 10px 20px;
    background-color: #337ab7;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background-color 0.3s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.theme-toggle:hover { background-color: #286090; }

.container { 
    background-color: #ffffff; 
    border: 1px solid #dddddd; 
    border-radius: 6px; 
    box-shadow: 0 4px 12px rgba(0,0,0,.1); 
    padding: 40px; 
    width: 100%;
    max-width: 950px; 
    transition: background-color 0.3s, border-color 0.3s;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid #eeeeee; 
    padding-bottom: 15px; 
    margin-bottom: 15px; 
}

h3 { 
    margin-top: 0; 
    font-size: 32px; 
    font-weight: 500; 
    margin-bottom: 0; 
    color: #222222;
    transition: color 0.3s, border-color 0.3s;
}

.api-status {
    font-size: 13px;
    font-weight: bold;
    padding: 6px 12px;
    border-radius: 20px;
    transition: all 0.3s;
}
.api-status.loading { background-color: #fcf8e3; color: #8a6d3b; border: 1px solid #faebcc; }
.api-status.live { background-color: #dff0d8; color: #3c763d; border: 1px solid #d6e9c6; animation: pulse 2s infinite; }
.api-status.offline { background-color: #f2dede; color: #a94442; border: 1px solid #ebccd1; }

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

.help-block { 
    display: block; 
    margin-bottom: 30px; 
    color: #737373; 
    font-size: 15px; 
    line-height: 1.6;
    transition: color 0.3s;
}

.row { 
    display: flex; 
    gap: 20px; 
    margin-bottom: 25px; 
    align-items: flex-end; 
}

.col { 
    flex: 1; 
}

.swap-row {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    margin-top: -10px;
}

.swap-btn {
    background-color: #f8f9fa;
    border: 1px solid #ccc;
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 14px;
    font-weight: bold;
    color: #555;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.swap-btn:hover {
    background-color: #e9ecef;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: scale(1.05);
}

.swap-btn:active {
    transform: scale(0.95);
}

label { 
    display: inline-block; 
    margin-bottom: 8px; 
    font-weight: 700; 
    font-size: 14px; 
    color: #333333;
    transition: color 0.3s;
}

.form-control { 
    display: block; 
    width: 100%; 
    height: 48px; 
    padding: 10px 16px; 
    font-size: 16px; 
    color: #555555; 
    background-color: #ffffff; 
    border: 1px solid #cccccc; 
    border-radius: 4px; 
    box-shadow: inset 0 1px 2px rgba(0,0,0,.075); 
    box-sizing: border-box; 
    font-family: inherit; 
    transition: background-color 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.2s;
}

select.form-control { 
    -webkit-appearance: none; 
    background-image: linear-gradient(45deg, transparent 50%, #999 50%), linear-gradient(135deg, #999 50%, transparent 50%); 
    background-position: calc(100% - 20px) calc(1em + 2px), calc(100% - 15px) calc(1em + 2px); 
    background-size: 5px 5px, 5px 5px; 
    background-repeat: no-repeat; 
    cursor: pointer;
}

.form-control:focus { 
    border-color: #66afe9; 
    outline: 0; 
    box-shadow: inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px rgba(102,175,233,.6); 
}

.panel { 
    background-color: #e9f5ff; 
    border: 1px solid #bce8f1; 
    border-radius: 6px; 
    padding: 35px; 
    margin-top: 30px; 
    font-family: Menlo, Monaco, Consolas, "Courier New", monospace; 
    font-size: 22px; 
    color: #31708f; 
    word-break: break-word; 
    position: relative; 
    line-height: 1.6; 
    text-align: center;
    transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

.warning-text { 
    color: #d9534f; 
    font-size: 14px; 
    font-weight: bold; 
    margin-top: 20px; 
    display: block; 
    border-top: 1px dashed #d9534f; 
    padding-top: 15px;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 
}

.bridge-text {
    font-size: 14px; 
    color: #777; 
    margin-top: 10px;
    display: block;
    font-style: italic;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; 
    transition: color 0.3s;
}

/* --- DARK MODE STYLES --- */
body.dark-mode { background-color: #121212; color: #e0e0e0; }
body.dark-mode .container { background-color: #1e1e1e; border-color: #333333; box-shadow: 0 4px 12px rgba(0,0,0,.5); }
body.dark-mode h3 { color: #ffffff; border-bottom-color: #444444; }
body.dark-mode .help-block { color: #aaaaaa; }
body.dark-mode label { color: #dddddd; }
body.dark-mode .form-control { background-color: #2c2c2c; color: #ffffff; border-color: #555555; }
body.dark-mode select.form-control { background-image: linear-gradient(45deg, transparent 50%, #777 50%), linear-gradient(135deg, #777 50%, transparent 50%); }
body.dark-mode .panel { background-color: #1a2630; border-color: #234b5e; color: #6db3d1; }
body.dark-mode .theme-toggle { background-color: #444; color: #eee; }
body.dark-mode .theme-toggle:hover { background-color: #555; }
body.dark-mode .swap-btn:hover { background-color: #555; }
body.dark-mode .bridge-text { color: #999999; }
body.dark-mode .header-row { border-bottom-color: #444444; }
body.dark-mode .api-status.loading { background-color: #4a4022; color: #d6c694; border-color: #5e5229; }
body.dark-mode .api-status.live { background-color: #254025; color: #8ecf8e; border-color: #315e31; }
body.dark-mode .api-status.offline { background-color: #402525; color: #cf8e8e; border-color: #5e3131; }

/* --- VISUALIZER STYLES --- */
.visualizer-container {
    margin-top: 25px;
    padding: 25px;
    background-color: #f9fbff;
    border: 1px solid #c4dceb;
    border-radius: 6px;
    transition: background-color 0.3s, border-color 0.3s;
}
body.dark-mode .visualizer-container {
    background-color: #1a2026;
    border-color: #2b3945;
}

.visualizer-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
.visualizer-header h4 { margin: 0; color: #333; transition: color 0.3s; }
body.dark-mode .visualizer-header h4 { color: #ddd; }

.vis-controls button {
    background-color: #fff;
    border: 1px solid #ccc;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    border-radius: 4px;
    margin-left: 5px;
    transition: all 0.2s;
}
.vis-controls button.active {
    background-color: #337ab7;
    color: #fff;
    border-color: #2e6da4;
}
body.dark-mode .vis-controls button { background-color: #333; color: #ccc; border-color: #555; }
body.dark-mode .vis-controls button.active { background-color: #337ab7; color: #fff; }

/* --- INFOGRAPHIC ENGINE STYLES --- */
.info-panel {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 20px;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 6px;
    min-height: 200px;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}
body.dark-mode .info-panel { background: #121212; border-color: #333; }

.info-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
    height: 100%;
}
.info-label {
    text-align: center;
    font-size: 13px;
    color: #555;
    margin-top: 15px;
    font-weight: bold;
    max-width: 120px;
    word-wrap: break-word;
}
body.dark-mode .info-label { color: #aaa; }

/* Thermometer */
.thermometer-wrap {
    width: 30px;
    height: 140px;
    background: #e0e0e0;
    border-radius: 15px;
    border: 3px solid #ccc;
    position: relative;
    margin: 0 auto;
    display: flex;
    align-items: flex-end;
}
.thermometer-fill {
    width: 100%;
    border-radius: 15px;
    background: linear-gradient(to top, #3498db, #e74c3c);
    transition: height 0.5s ease;
}
.thermometer-bulb {
    width: 46px;
    height: 46px;
    background: #e74c3c;
    border-radius: 50%;
    position: absolute;
    bottom: -23px;
    left: -11px;
    border: 3px solid #ccc;
    z-index: 2;
}

/* Spheres (Size/Mass/Volume) */
.sphere-wrap {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    width: 100%;
    height: 160px;
}
.sphere {
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #5bc0de, #2aabd2);
    box-shadow: inset -10px -10px 20px rgba(0,0,0,0.2), 0 5px 10px rgba(0,0,0,0.2);
    transition: width 0.5s, height 0.5s;
}

/* Area Nested */
.area-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 160px;
}
.area-box {
    border: 2px solid #5bc0de;
    background: rgba(91, 192, 222, 0.2);
    position: absolute;
    transition: width 0.5s, height 0.5s;
}

/* Timeline */
.timeline-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
    justify-content: center;
}
.timeline-bar-bg {
    width: 100%;
    height: 24px;
    background: #e0e0e0;
    border-radius: 12px;
    position: relative;
}
.timeline-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #9b59b6, #8e44ad);
    border-radius: 12px;
    transition: width 0.5s;
}

/* Finance Chart */
.finance-wrap {
    display: flex;
    align-items: flex-end;
    justify-content: space-around;
    width: 100%;
    height: 150px;
    border-bottom: 2px solid #ccc;
}
.finance-bar {
    width: 50px;
    background: linear-gradient(to top, #2ecc71, #27ae60);
    border-radius: 4px 4px 0 0;
    transition: height 0.5s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

/* Speed Track */
.speed-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 20px;
    border-left: 4px solid #ccc;
    border-right: 4px solid #ccc;
    padding: 10px 0;
    background: repeating-linear-gradient(90deg, transparent, transparent 10%, rgba(0,0,0,0.05) 10%, rgba(0,0,0,0.05) 11%);
}
.speed-line {
    height: 16px;
    background: #e74c3c;
    border-radius: 0 8px 8px 0;
    transition: width 0.5s;
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.5);
}

/* Gauge (Energy/Data/Pain) */
.gauge-wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.gauge-bar-bg {
    width: 100%;
    height: 20px;
    background: #333;
    border-radius: 4px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.5);
}
.gauge-bar-fill {
    height: 100%;
    background: #f1c40f;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(241, 196, 15, 0.8);
    transition: width 0.5s;
}

.visualizer-caption {
    margin-top: 15px;
    font-size: 14px;
    color: #666;
    text-align: center;
    font-style: italic;
}
body.dark-mode .visualizer-caption { color: #aaa; }

.ticking {
    font-family: 'Courier New', Courier, monospace;
    font-variant-numeric: tabular-nums;
    animation: popFlash 0.15s ease-out;
}
@keyframes popFlash {
    0% { transform: scale(1); color: #f0ad4e; }
    50% { transform: scale(1.05); color: #d9534f; }
    100% { transform: scale(1); color: inherit; }
}
