@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.hero-1.style-hosting {
    padding: 170px 0 170px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    background: white;
    padding: 20px 30px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.header h1 {
    color: #1e40af;
    font-size: 28px;
    margin-bottom: 10px;
}

.api-badge {
    display: inline-block;
    padding: 5px 15px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 10px;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.tab {
    padding: 10px 20px;
    background: #f0f0f0;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.tab:hover {
    background: #e0e0e0;
}

.tab.active {
    background: #2563eb;
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card .icon {
    font-size: 40px;
    margin-bottom: 15px;
}

.stat-card h3 {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-card .value {
    font-size: 32px;
    font-weight: bold;
    color: #333;
}

.stat-card .unit {
    font-size: 18px;
    color: #999;
    margin-left: 5px;
}

.chart-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.chart-card h2 {
    margin-bottom: 20px;
    color: #1e40af;
}

.loading {
    text-align: center;
    padding: 40px;
    color: #1e40af;
    font-size: 18px;
    font-weight: 500;
}

.error {
    background: #ff6b6b;
    color: white;
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.date-selector {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.date-selector input {
    padding: 2px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    color: #000;
}

.date-selector button {
    padding: 0px 20px;
    background: #2563eb;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.date-selector button:hover {
    background: #1d4ed8;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.pv {
    border-left: 5px solid #f59e0b;
}

.battery {
    border-left: 5px solid #06b6d4;
}

.grid {
    border-left: 5px solid #ef4444;
}

.load {
    border-left: 5px solid #10b981;
}

#rt-pv-power,
#rt-pv-voltage,
#rt-load-power,
#rt-load-backup,
#rt-grid-power,
#rt-ac-input-voltage,
#rt-soc,
#rt-bat-power {
    color: #FF5722 !important;
}

p {
    color: #000;
}

canvas {
    max-height: 400px;
}

@media (max-width: 768px) {
    .container {
        max-width: 100%;
    }

    .header {
        padding: 15px;
    }

    .header h1 {
        font-size: 20px;
        margin-bottom: 8px;
    }

    .header p {
        font-size: 16px !important;
    }

    .api-badge {
        font-size: 10px;
        padding: 4px 10px;
    }

    .header>div {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 15px !important;
    }

    .header>div>div:last-child {
        width: 100%;
        align-items: flex-start !important;
    }

    .subtitle {
        display: none;
    }

    .tabs {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        flex-wrap: nowrap;
    }

    .tabs::-webkit-scrollbar {
        display: none;
    }

    .tab {
        padding: 10px 16px;
        font-size: 13px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .date-selector {
        width: 100%;
        flex-direction: column;
        gap: 8px;
    }

    .date-selector label {
        font-size: 16px;
    }

    .date-selector input {
        width: 100%;
        font-size: 16px;
    }

    .date-selector button {
        width: 100%;
        font-size: 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 18px;
    }

    .stat-card .icon {
        font-size: 32px;
        margin-bottom: 10px;
    }

    .stat-card h3 {
        font-size: 12px;
    }

    .stat-card .value {
        font-size: 22px;
    }

    .stat-card .unit {
        font-size: 14px;
    }

    .chart-card {
        padding: 15px;
    }

    .chart-card h2,
    .chart-card h3 {
        font-size: 14px;
        margin-bottom: 12px;
    }

    canvas {
        max-height: 320px !important;
        min-height: 260px !important;
    }

    #hourlyChart,
    #monthlyBarChart {
        height: 320px !important;
    }

    /* Top 4 cards mobile */
    div[style*="grid-template-columns: repeat(auto-fit, minmax(200px, 1fr))"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    /* Middle section mobile */
    div[style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* Font size adjustments */
    div[style*="font-size: 24px"] {
        font-size: 20px !important;
    }

    div[style*="font-size: 16px"] {
        font-size: 14px !important;
    }

    div[style*="font-size: 13px"] {
        font-size: 12px !important;
    }

    /* Padding adjustments */
    div[style*="padding: 20px"] {
        padding: 10px 15px 10px 15px !important;
    }

    /* Table mobile */
    table {
        font-size: 12px !important;
    }

    table th,
    table td {
        padding: 8px 5px !important;
    }

    /* Loading state mobile */
    #loading-state div {
        padding: 20px;
    }

    #loading-state div div[style*="font-size: 48px"] {
        font-size: 36px !important;
    }

    #loading-state div div[style*="font-size: 24px"] {
        font-size: 18px !important;
    }

    /* Cell voltage mobile */
    #cell-voltage-data div[style*="grid-template-columns"] {
        grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)) !important;
        gap: 6px !important;
    }

    /* Biểu đồ biến tần mobile - chuyển sang layout dọc */
    .inverter-section {
        display: flex;
        flex-direction: column !important;
        align-items: center !important;
    }

    .inverter-section>div:first-child {
        flex: 0 0 auto !important;
        margin-bottom: 15px !important;
        text-align: center !important;
    }

    .inverter-section>div:first-child img {
        max-width: 120px !important;
    }

    .inverter-section>div:last-child {
        flex: 1 !important;
        padding-left: 0 !important;
        width: 100%;
    }

    .inverter-section>div:last-child>div {
        margin-bottom: 8px !important;
        font-size: 12px !important;
        line-height: 1.4 !important;
    }

    .inverter-section>div:last-child strong {
        font-size: 11px !important;
        display: inline-block;
    }

    .inverter-section>div:last-child span[style*="font-size: 20px"] {
        font-size: 14px !important;
        margin-right: 3px !important;
    }

    .inverter-section>div:last-child span[style*="background:"] {
        font-size: 10px !important;
        padding: 2px 6px !important;
    }

    /* Header biến tần mobile */
    .inverter-header {
        font-size: 14px !important;
    }

    .inverter-header span:first-of-type {
        font-size: 16px !important;
        padding: 2px 6px !important;
        display: inline-block !important;
        margin: 5px 0 !important;
    }

    .inverter-header span[style*="float: right"] {
        float: none !important;
        display: block !important;
        font-size: 16px !important;
        margin-top: 5px !important;
    }

    .h3-12 {
        margin-bottom: 15px;
    }

    .realtime-content {
        display: none;
    }

    .hero-1.style-hosting {
        padding: 70px 0px 35px;
    }

    .header {
        margin-bottom: 10px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 18px;
    }

    .tab {
        padding: 8px 12px;
        font-size: 14px;
    }

    .stat-card .value {
        font-size: 20px;
    }

    canvas {
        max-height: 280px !important;
        min-height: 240px !important;
    }

    #hourlyChart,
    #monthlyBarChart {
        height: 280px !important;
    }

    .chart-card {
        padding: 12px;
    }

    /* Ultra small devices */
    div[style*="font-size: 24px"] {
        font-size: 18px !important;
    }
}