/* ===== Firmware / HyperOS Downloader Styles ===== */

/* Device Header */
.fw-device-header {
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(135deg, #101010 0%, #1a1d24 100%);
    padding: 24px 20px;
    border-radius: 16px;
    margin-bottom: 20px;
}

.fw-device-header__img img {
    max-width: 72px;
    height: auto;
    border-radius: 8px;
}

.fw-device-header__info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.fw-device-header__title {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
}

.fw-device-header__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.fw-info-badge span {
    display: inline-block;
    padding: 3px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

/* Content Area */
.fw-content {
    margin-bottom: 28px;
}

.fw-content__desc {
    color: #5f6875;
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 20px;
}

/* Region Tabs */
.fw-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 0 0 4px;
    margin-bottom: 20px;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.fw-tabs::-webkit-scrollbar {
    display: none;
}

.fw-tabs__item {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    padding: 8px 18px;
    border: 1.5px solid #e5eaf1;
    border-radius: 24px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    text-decoration: none;
    transition: all .2s;
    white-space: nowrap;
}

.fw-tabs__item:hover {
    border-color: var(--second-c, #FF6700);
    color: var(--second-c, #FF6700);
    text-decoration: none;
}

.fw-tabs__item--active {
    background: var(--second-c, #FF6700);
    border-color: var(--second-c, #FF6700);
    color: #fff;
}

.fw-tabs__item--active:hover {
    color: #fff;
}

/* ROM Table */
.fw-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.fw-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    background: #fff;
    border: 1px solid #e5eaf1;
    border-radius: 14px;
    overflow: hidden;
}

.fw-table thead th {
    background: #f8fafb;
    color: #3b4252;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    padding: 12px 14px;
    text-align: left;
    border-bottom: 2px solid #e5eaf1;
    white-space: nowrap;
}

.fw-table tbody tr {
    transition: background .15s;
    cursor: pointer;
}

.fw-table tbody tr:hover {
    background: #fff5ee;
}

.fw-table tbody td {
    padding: 14px;
    border-bottom: 1px solid #f0f2f5;
    vertical-align: middle;
}

.fw-table tbody tr:last-child td {
    border-bottom: none;
}

.fw-table td a {
    color: var(--second-c, #FF6700);
    font-weight: 600;
    text-decoration: none;
}

.fw-table td a:hover {
    text-decoration: underline;
}

.fw-table .fw-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.fw-badge--yes {
    background: rgba(34, 197, 94, 0.1);
    color: #16a34a;
}

.fw-badge--no {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

/* Latest Updates Cards */
.fw-latest {
    margin-bottom: 28px;
}

.fw-latest__title {
    margin: 0 0 6px;
    font-size: 22px;
    font-weight: 700;
}

.fw-latest__subtitle {
    margin: 0 0 16px;
    color: #5f6875;
    font-size: 14px;
}

.fw-latest__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.fw-latest__card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: #fff;
    border: 1px solid #e5eaf1;
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    transition: transform .2s, box-shadow .2s, border-color .2s;
}

.fw-latest__card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.07);
    border-color: var(--second-c, #FF6700);
    text-decoration: none;
}

.fw-latest__card-img {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fw-latest__card-img img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 6px;
}

.fw-latest__card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.fw-latest__card-name {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    color: #1a1d24;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fw-latest__card-version {
    font-size: 13px;
    color: #5f6875;
    font-weight: 500;
}

/* Devices Browse Section */
.fw-devices {
    margin-bottom: 28px;
}

.fw-devices__header {
    margin-bottom: 16px;
}

.fw-devices__title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
}

.fw-devices__count {
    font-size: 14px;
    font-weight: 500;
    color: #8891a0;
    margin-left: 6px;
}

.fw-devices__brands {
    margin-bottom: 16px;
}

.fw-devices__more-wrap {
    text-align: center;
    margin-top: 20px;
}

.fw-btn--outline {
    background: #fff;
    color: var(--second-c, #FF6700);
    border: 1.5px solid var(--second-c, #FF6700);
    padding: 12px 32px;
    min-width: auto;
    flex: none;
}

.fw-btn--outline:hover {
    background: var(--second-c, #FF6700);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(255, 103, 0, 0.25);
}

/* Download Buttons */
.fw-download-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.fw-download-info {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
    align-items: flex-start;
}

.fw-download-info__title {
    width: 100%;
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: #333;
}

body.flavor-flavor-dark .fw-download-info__title {
    color: #ccc;
}

.fw-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: all .2s;
    flex: 1;
    min-width: 180px;
    text-align: center;
}

.fw-btn--primary {
    background: var(--second-c, #FF6700);
    color: #fff;
}

.fw-btn--primary:hover {
    background: #e55a00;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(255, 103, 0, 0.3);
}

.fw-btn--secondary {
    background: #1a1d24;
    color: #fff;
}

.fw-btn--secondary:hover {
    background: #2d3038;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

.fw-btn--disabled {
    background: #e5eaf1;
    color: #999;
    cursor: not-allowed;
    pointer-events: none;
}

/* Changelog */
.fw-changelog {
    background: #fff;
    border: 1px solid #e5eaf1;
    border-radius: 16px;
    padding: 20px 22px;
    margin-bottom: 20px;
}

.fw-changelog__title {
    margin: 0 0 12px;
    font-size: 18px;
    font-weight: 700;
}

.fw-changelog__content {
    font-size: 14px;
    line-height: 1.7;
    color: #444;
}

.fw-changelog__content ul {
    padding-left: 18px;
    margin: 0;
}

.fw-changelog__content li {
    margin-bottom: 6px;
}

.fw-changelog__empty {
    color: #999;
    font-style: italic;
}

/* Loading / Wait */
.fw-loading {
    text-align: center;
    padding: 40px 20px;
}

.fw-loading__spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e5eaf1;
    border-top-color: var(--second-c, #FF6700);
    border-radius: 50%;
    animation: fw-spin .7s linear infinite;
    margin: 0 auto 12px;
}

.fw-loading__text {
    font-size: 15px;
    color: #5f6875;
    font-weight: 500;
}

@keyframes fw-spin {
    to { transform: rotate(360deg); }
}

/* Version Page Layout */
.fw-version-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.fw-version-meta {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fw-meta-card {
    background: #fff;
    border: 1px solid #e5eaf1;
    border-radius: 14px;
    padding: 16px 18px;
}

.fw-meta-card__label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    color: #888;
    margin-bottom: 4px;
}

.fw-meta-card__value {
    font-size: 16px;
    font-weight: 700;
    color: #1a1d24;
}

/* ---- Dark Mode ---- */
body.wp-night-mode-on .fw-device-header {
    background: linear-gradient(135deg, #1a1d24 0%, #2d3038 100%);
}

body.wp-night-mode-on .fw-tabs__item {
    background: #1a1a1a;
    border-color: #333;
    color: #ccc;
}

body.wp-night-mode-on .fw-tabs__item:hover {
    border-color: var(--second-c, #FF6700);
    color: var(--second-c, #FF6700);
}

body.wp-night-mode-on .fw-tabs__item--active {
    background: var(--second-c, #FF6700);
    border-color: var(--second-c, #FF6700);
    color: #fff;
}

body.wp-night-mode-on .fw-table {
    background: #1a1c20;
    border-color: #2d3038;
}

body.wp-night-mode-on .fw-table thead th {
    background: #22252a;
    color: #d1d5db;
    border-color: #333;
}

body.wp-night-mode-on .fw-table tbody tr:hover {
    background: #22252a;
}

body.wp-night-mode-on .fw-table tbody td {
    border-color: #2d3038;
    color: #d1d5db;
}

body.wp-night-mode-on .fw-table td a {
    color: #ff8c33;
}

body.wp-night-mode-on .fw-latest__card {
    background: #1a1c20;
    border-color: #2d3038;
}

body.wp-night-mode-on .fw-latest__card:hover {
    border-color: var(--second-c, #FF6700);
}

body.wp-night-mode-on .fw-latest__card-name {
    color: #eaecf0;
}

body.wp-night-mode-on .fw-latest__card-version {
    color: #8891a0;
}

body.wp-night-mode-on .fw-changelog {
    background: #1a1c20;
    border-color: #2d3038;
}

body.wp-night-mode-on .fw-changelog__content {
    color: #d1d5db;
}

body.wp-night-mode-on .fw-meta-card {
    background: #1a1c20;
    border-color: #2d3038;
}

body.wp-night-mode-on .fw-meta-card__value {
    color: #eaecf0;
}

body.wp-night-mode-on .fw-content__desc {
    color: #8891a0;
}

body.wp-night-mode-on .fw-info-badge span {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.7);
}

body.wp-night-mode-on .fw-btn--secondary {
    background: #2d3038;
}

body.wp-night-mode-on .fw-btn--disabled {
    background: #22252a;
    color: #555;
}

body.wp-night-mode-on .fw-devices__count {
    color: #6b7280;
}

body.wp-night-mode-on .fw-btn--outline {
    background: transparent;
    border-color: var(--second-c, #FF6700);
    color: var(--second-c, #FF6700);
}

body.wp-night-mode-on .fw-btn--outline:hover {
    background: var(--second-c, #FF6700);
    color: #fff;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
    .fw-device-header {
        padding: 18px 16px;
        gap: 14px;
    }

    .fw-device-header__title {
        font-size: 17px;
    }

    .fw-device-header__img img {
        max-width: 56px;
    }

    .fw-latest__grid {
        grid-template-columns: 1fr;
    }

    .fw-version-layout {
        grid-template-columns: 1fr;
    }

    .fw-download-actions {
        flex-direction: column;
    }

    .fw-btn {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .fw-device-header__meta {
        gap: 4px;
    }

    .fw-info-badge span {
        font-size: 11px;
        padding: 2px 8px;
    }
}

/* Copy button */
.fw-copy-btn {
    display: inline-block;
    padding: 2px 8px;
    margin-left: 6px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(255, 103, 0, 0.1);
    color: var(--second-c, #FF6700);
    border: 1px solid rgba(255, 103, 0, 0.2);
    border-radius: 4px;
    cursor: pointer;
    transition: all .15s;
    vertical-align: middle;
}

.fw-copy-btn:hover {
    background: var(--second-c, #FF6700);
    color: #fff;
}

/* OTA Section */
.fw-ota-section {
    margin-top: 24px;
    padding: 20px;
    background: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    border: 1.5px solid #bbf7d0;
    border-radius: 14px;
}

.fw-ota-section__title {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 700;
    color: #15803d;
}

.fw-ota-section__from {
    margin: 0 0 14px;
    font-size: 13px;
    color: #555;
    line-height: 1.5;
}

.fw-ota-section__from strong {
    color: #333;
}

.fw-btn--ota {
    background: #16a34a;
    color: #fff;
    min-width: auto;
    flex: none;
    padding: 12px 24px;
}

.fw-btn--ota:hover {
    background: #15803d;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(22, 163, 74, 0.3);
}

body.flavor-flavor-dark .fw-ota-section {
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.08) 0%, rgba(22, 163, 74, 0.04) 100%);
    border-color: rgba(22, 163, 74, 0.25);
}

body.flavor-flavor-dark .fw-ota-section__title {
    color: #4ade80;
}

body.flavor-flavor-dark .fw-ota-section__from {
    color: #999;
}

body.flavor-flavor-dark .fw-ota-section__from strong {
    color: #ccc;
}

/* Empty state */
.fw-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 48px 24px;
    text-align: center;
    color: #888;
    border: 2px dashed #e0e0e0;
    border-radius: 12px;
    margin-top: 16px;
}

.fw-empty svg {
    opacity: 0.4;
}

.fw-empty p {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    max-width: 400px;
}

body.flavor-flavor-dark .fw-empty {
    color: #999;
    border-color: #333;
}
