/* ============================================================
   Apple Software — IPSW Firmware Downloads
   Same monospace aesthetic as byteCoder / billheyman.com
   ============================================================ */

/* --- Reset & Base --- */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Courier New', Courier, monospace;
    font-size: 15px;
    line-height: 1.6;
    color: #333;
    background: #fff;
}

a {
    color: #0066cc;
    text-decoration: none;
}

a:hover {
    color: #0052a3;
    text-decoration: underline;
}

/* --- Header --- */

header {
    border-bottom: 1px solid #ddd;
    padding: 1em 1.5em;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 100;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 1.5em;
}

.logo {
    font-size: 1.4em;
    font-weight: bold;
    color: #333;
    white-space: nowrap;
    letter-spacing: -0.5px;
}

.logo:hover {
    color: #0066cc;
    text-decoration: none;
}

.tagline {
    font-size: 0.85em;
    color: #888;
    white-space: nowrap;
}

.tagline a {
    color: #0066cc;
}

.count {
    font-size: 0.8em;
    color: #888;
    white-space: nowrap;
}

.search-wrap {
    flex: 1;
    max-width: 400px;
}

#search {
    width: 100%;
    font-family: inherit;
    font-size: 0.9em;
    padding: 0.5em 0.75em;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #f9f9f9;
    color: #333;
    outline: none;
    transition: border-color 0.2s;
}

#search:focus {
    border-color: #0066cc;
    background: #fff;
}

/* --- Filter Pills --- */

nav#filters {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75em 1.5em;
    border-bottom: 1px solid #ddd;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4em;
    align-items: center;
}

.pill {
    font-family: inherit;
    font-size: 0.8em;
    padding: 0.3em 0.7em;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #f0f0f0;
    color: #555;
    cursor: pointer;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.pill:hover {
    background: #e0e0e0;
    border-color: #ccc;
}

.pill.active {
    background: #0066cc;
    color: #fff;
    border-color: #0066cc;
}

.pill-divider {
    width: 1px;
    height: 1.2em;
    background: #ddd;
    margin: 0 0.3em;
}

/* --- Device / Version Selects --- */

.device-bar {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.75em 1.5em;
    border-bottom: 1px solid #ddd;
    display: flex;
    gap: 1em;
    align-items: center;
}

.device-bar select {
    font-family: inherit;
    font-size: 0.85em;
    padding: 0.4em 0.6em;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #f9f9f9;
    color: #333;
    outline: none;
    min-width: 200px;
    cursor: pointer;
}

.device-bar select:focus {
    border-color: #0066cc;
}

/* --- Firmware Table --- */

main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1em 1.5em;
}

.fw-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85em;
}

.fw-table th {
    text-align: left;
    padding: 0.6em 0.75em;
    border-bottom: 2px solid #ddd;
    color: #666;
    font-weight: bold;
    white-space: nowrap;
    position: sticky;
    top: 60px;
    background: #fff;
    z-index: 10;
}

.fw-table td {
    padding: 0.5em 0.75em;
    border-bottom: 1px solid #eee;
    vertical-align: middle;
}

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

.fw-table .device-name {
    font-weight: bold;
    color: #333;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.fw-table .device-id {
    font-size: 0.85em;
    color: #999;
}

.fw-table .version {
    font-weight: bold;
}

.fw-table .build {
    color: #666;
    font-size: 0.9em;
}

.fw-table .date {
    white-space: nowrap;
    color: #666;
}

.fw-table .size {
    white-space: nowrap;
    color: #666;
}

.badge-signed {
    display: inline-block;
    font-size: 0.75em;
    padding: 0.15em 0.5em;
    border-radius: 2px;
    font-weight: bold;
}

.badge-signed.yes {
    background: #d4edda;
    color: #155724;
}

.badge-signed.no {
    background: #f0f0f0;
    color: #999;
}

.platform-badge {
    display: inline-block;
    font-size: 0.75em;
    padding: 0.15em 0.5em;
    border-radius: 2px;
    background: #e8e8e8;
    color: #666;
    white-space: nowrap;
}

.platform-badge.ios { background: #e3f2fd; color: #1565c0; }
.platform-badge.ipados { background: #e8f5e9; color: #2e7d32; }
.platform-badge.macos { background: #fce4ec; color: #c62828; }
.platform-badge.watchos { background: #fff3e0; color: #e65100; }
.platform-badge.visionos { background: #f3e5f5; color: #6a1b9a; }
.platform-badge.tvos { background: #e0f2f1; color: #00695c; }

.dl-btn {
    display: inline-block;
    font-family: inherit;
    font-size: 0.8em;
    padding: 0.3em 0.6em;
    border: 1px solid #0066cc;
    border-radius: 3px;
    color: #0066cc;
    background: #fff;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}

.dl-btn:hover {
    background: #0066cc;
    color: #fff;
    text-decoration: none;
}

.checksum {
    font-size: 0.7em;
    color: #999;
    cursor: pointer;
    word-break: break-all;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: block;
}

.checksum:hover {
    color: #0066cc;
}

.checksum-toast {
    position: fixed;
    bottom: 1.5em;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: #fff;
    padding: 0.5em 1.5em;
    border-radius: 3px;
    font-size: 0.85em;
    z-index: 200;
    opacity: 0;
    transition: opacity 0.3s;
}

.checksum-toast.visible {
    opacity: 1;
}

/* --- Loading / Empty States --- */

.loading, .empty {
    text-align: center;
    padding: 2em;
    color: #888;
    font-size: 0.95em;
}

.loading[aria-hidden="true"],
.empty[aria-hidden="true"] {
    display: none;
}

/* --- Footer --- */

footer {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2em 1.5em;
    border-top: 1px solid #ddd;
    text-align: center;
    font-size: 0.85em;
    color: #888;
}

/* --- Responsive --- */

@media (max-width: 900px) {
    .header-inner {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75em;
    }

    .logo {
        text-align: center;
    }

    .search-wrap {
        max-width: 100%;
    }

    .device-bar {
        flex-direction: column;
        gap: 0.5em;
    }

    .device-bar select {
        min-width: 100%;
    }

    nav#filters {
        padding: 0.5em 1em;
    }

    main {
        padding: 0.5em;
        overflow-x: auto;
    }

    .fw-table {
        font-size: 0.75em;
        min-width: 700px;
    }

    .fw-table .device-name {
        max-width: 140px;
    }
}

@media (max-width: 600px) {
    .fw-table {
        min-width: 600px;
    }

    .th-signed, .td-signed {
        display: none;
    }
}

/* --- Print --- */

@media print {
    header, nav, footer, .loading, .empty { display: none; }
    .fw-table th { position: static; }
    .dl-btn { border: 1px solid #333; color: #333; }
}
