/* ============================================================
   FILE: css/pages/ai-power-hub.css
   Mục đích: Styling cho AI Power Hub section
   ============================================================ */

/* ===== MAIN CONTAINER ===== */
.power-hub-container {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ===== HEADER STATS ===== */
.power-hub-header {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.power-hub-stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    color: white !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.power-hub-stat-card * {
    color: white !important;
}

.power-hub-stat-card:nth-child(2) {
    background: linear-gradient(135deg, #0f9b82 0%, #1bb76e 100%);
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.3);
}

.power-hub-stat-card:nth-child(3) {
    background: linear-gradient(135deg, #2193b0 0%, #6dd5ed 100%);
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
}

.power-hub-stat-card:nth-child(4) {
    background: linear-gradient(135deg, #e44d26 0%, #f16529 100%);
    box-shadow: 0 4px 15px rgba(228, 77, 38, 0.3);
}

.power-hub-stat-card:nth-child(5) {
    background: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
    box-shadow: 0 4px 15px rgba(106, 17, 203, 0.3);
}

.power-hub-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.power-hub-stat-card .stat-icon {
    font-size: 2.5rem;
}

.power-hub-stat-card .stat-content {
    display: flex;
    flex-direction: column;
}

.power-hub-stat-card .stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.2;
}

.power-hub-stat-card .stat-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

/* ===== PROVIDERS GRID ===== */
.power-hub-providers {
    margin-bottom: 30px;
}

.power-hub-providers h3 {
    font-size: 1.3rem;
    margin-bottom: 15px;
    color: #333;
}

.provider-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.provider-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
}

.provider-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

.provider-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.provider-icon {
    font-size: 1.5rem;
}

.provider-name {
    font-weight: 600;
    font-size: 1.1rem;
    flex: 1;
}

.provider-intelligence {
    font-size: 0.8rem;
}

.provider-model {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 15px;
    font-family: monospace;
    background: #f5f5f5;
    padding: 5px 10px;
    border-radius: 6px;
}

.provider-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.provider-keys {
    display: flex;
    flex-direction: column;
}

.provider-keys .key-count {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
}

.provider-keys .key-label {
    font-size: 0.75rem;
    color: #888;
}

.provider-quota {
    flex: 1;
    margin-left: 20px;
}

.quota-bar {
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.quota-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #8BC34A);
    border-radius: 4px;
    transition: width 0.3s;
}

.quota-text {
    font-size: 0.75rem;
    color: #666;
}

.btn-add-key {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-add-key:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* ===== KEYS LIST ===== */
.power-hub-keys {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.power-hub-keys h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #333;
}

.keys-provider-group {
    margin-bottom: 20px;
}

.keys-provider-group h4 {
    font-size: 1rem;
    color: #555;
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid #eee;
}

.key-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 8px;
    transition: background 0.2s;
}

.key-item:hover {
    background: #f0f0f0;
}

.key-item.rate_limited {
    background: #fff3cd;
}

.key-item.error {
    background: #f8d7da;
}

.key-name {
    font-weight: 600;
    min-width: 100px;
}

.key-value {
    font-family: monospace;
    color: #666;
    flex: 1;
}

.key-status {
    font-size: 1.2rem;
}

.key-requests {
    font-size: 0.85rem;
    color: #888;
    min-width: 100px;
    text-align: right;
}

.btn-remove-key {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 5px;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.btn-remove-key:hover {
    opacity: 1;
}

.no-keys {
    text-align: center;
    color: #888;
    padding: 30px;
    font-style: italic;
}

/* ===== HISTORY ===== */
.power-hub-history {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.power-hub-history h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
    color: #333;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 10px 15px;
    border-radius: 8px;
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.history-item.success {
    background: #d4edda;
}

.history-item.error {
    background: #f8d7da;
}

.history-time {
    color: #666;
    min-width: 80px;
}

.history-provider {
    font-weight: 500;
    min-width: 120px;
}

.history-status {
    font-size: 1rem;
}

.history-duration {
    color: #666;
    min-width: 60px;
}

.history-tokens {
    color: #888;
    font-size: 0.85rem;
}

/* ===== MODAL ===== */
.power-hub-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.power-hub-modal .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
}

.power-hub-modal .modal-content {
    position: relative;
    z-index: 10001;
    background: white;
    padding: 30px;
    border-radius: 16px;
    width: 90%;
    max-width: 450px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.power-hub-modal .modal-content h3 {
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.power-hub-modal .form-group {
    margin-bottom: 15px;
}

.power-hub-modal .form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #555;
}

.power-hub-modal .form-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.power-hub-modal .form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.power-hub-modal .modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.power-hub-modal .btn-cancel {
    flex: 1;
    padding: 12px;
    background: #f0f0f0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.power-hub-modal .btn-save {
    flex: 1;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .power-hub-header {
        grid-template-columns: repeat(2, 1fr);
    }

    .provider-grid {
        grid-template-columns: 1fr;
    }

    .key-item {
        flex-wrap: wrap;
    }

    .key-value {
        width: 100%;
        order: 10;
        margin-top: 5px;
    }
}

/* ===== DARK MODE ===== */
[data-theme="dark"] .power-hub-providers h3,
[data-theme="dark"] .power-hub-keys h3,
[data-theme="dark"] .power-hub-history h3 {
    color: #fff;
}

[data-theme="dark"] .provider-card,
[data-theme="dark"] .power-hub-keys,
[data-theme="dark"] .power-hub-history {
    background: #1e1e2e;
    color: #fff;
}

[data-theme="dark"] .provider-model {
    background: #2d2d3d;
    color: #ccc;
}

[data-theme="dark"] .key-item {
    background: #2d2d3d;
}

[data-theme="dark"] .key-item:hover {
    background: #3d3d4d;
}

[data-theme="dark"] .history-item.success {
    background: rgba(40, 167, 69, 0.2);
}

[data-theme="dark"] .history-item.error {
    background: rgba(220, 53, 69, 0.2);
}

[data-theme="dark"] .power-hub-modal .modal-content {
    background: #1e1e2e;
    color: #fff;
}

[data-theme="dark"] .power-hub-modal .form-group input {
    background: #2d2d3d;
    border-color: #3d3d4d;
    color: #fff;
}

[data-theme="dark"] .power-hub-modal .btn-cancel {
    background: #3d3d4d;
    color: #fff;
}