/* BoxTrades Manager Admin Styles */

.boxtrades-wrap {
    max-width: 1200px;
}

.boxtrades-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.boxtrades-card {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.boxtrades-card h2 {
    margin-top: 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.boxtrades-card h3 {
    margin-top: 20px;
    font-size: 14px;
}

/* Yields Card - Primary Focus */
.boxtrades-yields-card {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.boxtrades-yields-card h2 {
    color: white;
    border-bottom-color: rgba(255,255,255,0.3);
}

.boxtrades-yields-card h3 {
    color: rgba(255,255,255,0.9);
}

.boxtrades-yields-card code {
    background: rgba(255,255,255,0.2);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.yields-display {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.yield-box {
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 20px;
    flex: 1;
    min-width: 200px;
    text-align: center;
}

.yield-box .yield-label {
    display: block;
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 10px;
}

.yield-box .yield-value {
    display: block;
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 10px;
}

.yield-box .yield-date,
.yield-box .yield-years {
    display: block;
    font-size: 12px;
    opacity: 0.8;
}

.yield-updated {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 15px;
}

/* Status indicator */
.status-indicator {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 15px;
}

.status-ok {
    background: #d4edda;
    color: #155724;
}

.status-error {
    background: #f8d7da;
    color: #721c24;
}

.boxtrades-card table.widefat {
    margin-top: 10px;
}

.boxtrades-card table.widefat th {
    width: 140px;
    font-weight: 600;
}

.error-message {
    color: #721c24;
    font-family: monospace;
    font-size: 12px;
}

.boxtrades-card .success {
    color: #155724;
    font-weight: bold;
}

.boxtrades-card .error {
    color: #721c24;
    font-weight: bold;
}

#script-output {
    margin-top: 15px;
    background: #1e1e1e;
    border-radius: 4px;
    padding: 15px;
}

#script-output pre {
    color: #d4d4d4;
    margin: 0;
    font-size: 12px;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 300px;
    overflow-y: auto;
}

.boxtrades-card .button {
    margin-right: 10px;
}

.form-table th {
    width: 200px;
}

/* Loading spinner */
.boxtrades-loading {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

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

/* Frontend shortcode styles */
.boxtrades-yield-box {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    max-width: 300px;
    margin: 10px 0;
}

.boxtrades-yield-label {
    display: block;
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.boxtrades-yield-value {
    display: block;
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 8px;
}

.boxtrades-yield-date {
    display: block;
    font-size: 12px;
    opacity: 0.8;
}

.boxtrades-yields-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.boxtrades-yields-table th,
.boxtrades-yields-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.boxtrades-yields-table th {
    background: #f5f5f5;
    font-weight: 600;
}

.boxtrades-yields-table tr:hover {
    background: #f9f9f9;
}

.boxtrades-updated {
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.boxtrades-error,
.boxtrades-yield-error,
.boxtrades-swap-error {
    color: #721c24;
    background: #f8d7da;
    padding: 10px;
    border-radius: 4px;
}

/* Swap Rates Card Styles */
.boxtrades-swap-card {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    border: none;
}

.boxtrades-swap-card h2 {
    color: white;
    border-bottom-color: rgba(255,255,255,0.3);
}

.boxtrades-swap-card h3 {
    color: rgba(255,255,255,0.9);
}

.boxtrades-swap-card code {
    background: rgba(255,255,255,0.2);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 12px;
}

.swap-rates-display {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin: 20px 0;
}

.swap-box {
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    padding: 20px;
    flex: 1;
    min-width: 200px;
    text-align: center;
}

.swap-box .swap-label {
    display: block;
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 10px;
}

.swap-box .swap-value {
    display: block;
    font-size: 32px;
    font-weight: bold;
    margin-bottom: 10px;
}

.swap-box .swap-source {
    display: block;
    font-size: 11px;
    opacity: 0.7;
}

.swap-updated {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 15px;
}

/* Frontend swap shortcode styles */
.boxtrades-swap-box {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    max-width: 300px;
    margin: 10px 0;
}

.boxtrades-swap-label {
    display: block;
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 8px;
}

.boxtrades-swap-value {
    display: block;
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 8px;
}

.boxtrades-swap-source {
    display: block;
    font-size: 11px;
    opacity: 0.7;
}

.boxtrades-swap-table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
}

.boxtrades-swap-table th,
.boxtrades-swap-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.boxtrades-swap-table th {
    background: #f5f5f5;
    font-weight: 600;
}

.boxtrades-swap-table tr:hover {
    background: #f9f9f9;
}

/* Chart Styles */
.boxtrades-chart-wrapper {
    background: #fff;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin: 20px 0;
}

.boxtrades-chart-header {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.chart-selector {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.chart-selector label {
    font-size: 11px;
    font-weight: 600;
    color: #666;
    letter-spacing: 0.5px;
}

.chart-selector select {
    padding: 10px 35px 10px 15px;
    font-size: 14px;
    border: 2px solid #667eea;
    border-radius: 25px;
    background: #fff;
    color: #333;
    cursor: pointer;
    min-width: 180px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.chart-selector select:focus {
    outline: none;
    border-color: #764ba2;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.boxtrades-chart-container {
    position: relative;
    width: 100%;
    min-height: 300px;
}

.boxtrades-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.chart-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    font-size: 14px;
}

.boxtrades-chart-container canvas:not(:empty) + .chart-loading {
    display: none;
}

/* Time range buttons (alternative style) */
.time-range-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.time-range-btn {
    padding: 6px 16px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.time-range-btn:hover {
    border-color: #667eea;
    color: #667eea;
}

.time-range-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

/* Responsive */
@media screen and (max-width: 782px) {
    .boxtrades-dashboard {
        grid-template-columns: 1fr;
    }

    .form-table th {
        width: auto;
    }

    .yields-display,
    .swap-rates-display {
        flex-direction: column;
    }

    .yield-box,
    .swap-box {
        min-width: auto;
    }
}
