:root {
    --bg-color: #0b0f19;
    --container-bg: rgba(16, 24, 39, 0.7);
    --primary-accent: #3b82f6;
    /* Vibrant Blue */
    --secondary-accent: #8b5cf6;
    /* Vibrant Purple */
    --tertiary-accent: #06b6d4;
    /* Vibrant Cyan */
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --border-glow: rgba(59, 130, 246, 0.5);
    --danger: #ef4444;
    --success: #10b981;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    background: radial-gradient(circle at top right, #1e1b4b, #0b0f19 60%);
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    padding: 30px 20px;
    overflow-x: hidden;
    background-attachment: fixed;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: var(--container-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 40px rgba(59, 130, 246, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.container:hover {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 60px rgba(59, 130, 246, 0.25);
}

.coco-badge-container {
    text-align: center;
    margin-bottom: 25px;
    margin-top: 10px;
}

.coco-badge {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(to bottom, #fdfdfd 0%, #d1d5db 50%, #9ca3af 100%);
    border: 1.5px solid #4b5563;
    box-shadow:
        inset 0 1px 2px rgba(255, 255, 255, 0.9),
        inset 0 -1px 2px rgba(0, 0, 0, 0.2),
        0 4px 15px rgba(0, 0, 0, 0.4),
        0 0 25px rgba(59, 130, 246, 0.15);
    border-radius: 2px;
    padding: 4px 6px;
    gap: 12px;
    user-select: none;
    position: relative;
}

/* Subtle metallic brushed reflection */
.coco-badge::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.4) 15%, transparent 30%, transparent 70%, rgba(255, 255, 255, 0.4) 85%, transparent 100%);
    pointer-events: none;
    border-radius: 2px;
}

.badge-box {
    background: #000000;
    border-radius: 4px;
    padding: 8px 16px;
    color: #ffffff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow:
        inset 0 3px 6px rgba(0, 0, 0, 1),
        0 1px 0 rgba(255, 255, 255, 0.4);
    min-height: 48px;
    position: relative;
    z-index: 1;
    /* Above the reflection highlight */
}

.badge-middle {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0 8px;
    position: relative;
    z-index: 1;
}

.badge-trs80 {
    color: #2e1d38;
    /* Signature dark purple-grey */
    font-family: 'Arial Black', 'Inter', sans-serif;
    font-weight: 900;
    font-size: 1.05em;
    letter-spacing: 1.5px;
    text-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);
}

.badge-colors {
    display: flex;
    gap: 6px;
}

.badge-color {
    width: 20px;
    height: 10px;
    border-radius: 2px;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4), 0 1px 0 rgba(255, 255, 255, 0.7);
}

.badge-color.red {
    background: #ff1a1a;
}

.badge-color.green {
    background: #00e640;
}

.badge-color.blue {
    background: #0066ff;
}

.badge-right-text {
    font-family: 'Courier New', Courier, monospace;
    font-weight: bold;
    font-size: 1em;
    text-align: center;
    line-height: 1.05;
    letter-spacing: 1.5px;
    text-shadow: 0 0 1px rgba(255, 255, 255, 0.4);
}

.subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.05em;
}

.app-description {
    text-align: center;
    color: var(--text-muted);
    max-width: 720px;
    margin: 0 auto 40px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.control-panel {
    margin-bottom: 30px;
    display: none;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.control-panel.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.control-panel h2,
.upload-section h2 {
    color: var(--text-main);
    margin-bottom: 20px;
    font-size: 1.4em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.controls {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.controls>button,
.controls>.dsk-mounted-btn,
.upload-buttons button,
.modal-buttons button {
    flex: 1;
    min-width: 200px;
}

button {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1), rgba(37, 99, 235, 0.2));
    color: var(--text-main);
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 12px 24px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(4px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

button:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.8), rgba(37, 99, 235, 0.9));
    color: white;
    border-color: rgba(96, 165, 250, 0.8);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
}

button:active:not(:disabled) {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Specific Button Types */
.download-dsk-btn {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(5, 150, 105, 0.2));
    border-color: rgba(16, 185, 129, 0.3);
}

.download-dsk-btn:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.8), rgba(5, 150, 105, 0.9));
    border-color: rgba(52, 211, 153, 0.8);
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
}

.viz-toggle-btn {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.1), rgba(109, 40, 217, 0.2));
    border-color: rgba(139, 92, 246, 0.3);
}

.viz-toggle-btn:hover {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.8), rgba(109, 40, 217, 0.9));
    border-color: rgba(167, 139, 250, 0.8);
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.4);
}

.add-file-btn {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border: none;
    padding: 8px 16px;
    font-size: 0.85em;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}

.add-file-btn:hover {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    box-shadow: 0 6px 15px rgba(37, 99, 235, 0.5);
    transform: translateY(-2px) scale(1.02);
    border: none;
}

/* Small Actions Buttons */
.download-btn,
.view-hex-btn,
.view-btn,
.delete-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
    min-width: 80px;
    border-radius: 6px;
}

.delete-btn {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--danger);
    min-width: 40px;
}

.delete-btn:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
    transform: scale(1.05);
}

/* Upload Section */
.upload-section {
    text-align: center;
    padding: 60px 20px;
    background: rgba(59, 130, 246, 0.05);
    border: 2px dashed rgba(59, 130, 246, 0.3);
    border-radius: 16px;
    margin: 20px 0;
    transition: all 0.3s ease;
}

.upload-section:hover {
    background: rgba(59, 130, 246, 0.08);
    border-color: rgba(59, 130, 246, 0.6);
}

.upload-section p {
    color: var(--text-muted);
    margin-bottom: 30px;
    font-size: 1.1em;
}

.file-input-wrapper {
    display: inline-block;
}

input[type="file"] {
    display: none;
}

.file-input-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    padding: 14px 32px;
    cursor: pointer;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s;
    min-width: 200px;
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.file-input-label:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.5);
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
}

.upload-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Ejecting State */
.ejecting-message {
    display: none;
    text-align: center;
    padding: 80px 20px;
    background: rgba(245, 158, 11, 0.05);
    border: 2px solid rgba(245, 158, 11, 0.3);
    border-radius: 16px;
    margin: 20px 0;
    backdrop-filter: blur(8px);
}

.ejecting-message.active {
    display: block;
    animation: fadeIn 0.3s ease-out;
}

.ejecting-message h2 {
    color: #f59e0b;
    font-size: 2.5em;
    margin-bottom: 20px;
    font-weight: 800;
    background: linear-gradient(to right, #f59e0b, #fbbf24);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 30px rgba(245, 158, 11, 0.3);
}

.ejecting-icon {
    font-size: 5em;
    margin-bottom: 20px;
    display: inline-block;
    filter: drop-shadow(0 0 20px rgba(245, 158, 11, 0.5));
    animation: eject-float 3s ease-in-out infinite;
}

@keyframes eject-float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

/* File List Table */
.file-list {
    margin-top: 30px;
}

.file-list table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.file-list th {
    background: rgba(16, 24, 39, 0.8);
    color: var(--text-muted);
    padding: 16px;
    text-align: left;
    font-weight: 600;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.file-list td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    vertical-align: middle;
    font-size: 0.95em;
}

.file-list tr:last-child td {
    border-bottom: none;
}

.file-list tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

.file-list tr[style*="cursor: pointer"]:hover {
    background: rgba(6, 182, 212, 0.1);
}

.file-list td:first-child {
    font-family: 'Courier New', monospace;
    color: #93c5fd;
    font-weight: bold;
}

.actions-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.actions-cell {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.actions-left {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

/* Modals & Menus */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 9, 20, 0.8);
    backdrop-filter: blur(8px);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 1;
}

.modal-content {
    background: #0f172a;
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 16px;
    padding: 35px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8), 0 0 40px rgba(59, 130, 246, 0.1);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal.pop-out-active .modal-content {
    animation: popOutFromSector 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes popOutFromSector {
    0% {
        transform: scale(0.1);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-content h3 {
    color: white;
    margin-bottom: 25px;
    font-size: 1.5em;
    font-weight: 700;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-size: 0.9em;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    background: rgba(0, 0, 0, 0.6);
}

.form-group input:disabled,
.form-group select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(255, 255, 255, 0.02);
}

.message {
    padding: 16px;
    margin: 0 0 20px 0;
    border-radius: 8px;
    display: none;
    font-weight: 500;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.error {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--danger);
    color: #fca5a5;
}

.message.success {
    background: rgba(16, 185, 129, 0.1);
    border-left: 4px solid var(--success);
    color: #6ee7b7;
}

.message.active {
    display: block;
}

/* Disk Header Top Layout */
.dsk-mounted-btn {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(37, 99, 235, 0.3));
    border: 1px solid var(--primary-accent);
    padding: 14px 20px;
    font-size: 1.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    flex: 2 !important;
    max-width: 500px;
}

.dsk-mounted-btn .disk-icon {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.dsk-mounted-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: var(--danger);
    color: #fca5a5;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.2);
}

.modified-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-left: auto;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

/* Menus */
.download-menu,
.hex-menu {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    z-index: 100;
    min-width: 160px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    animation: menuFade 0.2s ease;
}

@keyframes menuFade {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.download-menu.active,
.hex-menu.active {
    display: block;
}

.download-menu-item,
.hex-menu-item {
    padding: 10px 16px;
    color: var(--text-main);
    font-size: 0.85em;
    cursor: pointer;
    transition: background 0.2s;
}

.download-menu-item:hover,
.hex-menu-item:hover {
    background: var(--primary-accent);
    color: white;
}

/* Disk Visualization (Keep internal styling intact but restyle wrapper) */
.disk-viz-section {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(4, 9, 20, 0.9);
    backdrop-filter: blur(10px);
    z-index: 1000;
    overflow-y: auto;
    padding: 40px 10px;
}

.disk-viz-section.active {
    display: block;
}

.disk-viz-modal-content {
    background: #0f172a;
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.8);
    max-width: 95%;
    width: 1125px;
    margin: 0 auto;
}

.disk-viz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.disk-viz-header h2 {
    color: white;
    margin: 0;
}

.disk-viz-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.disk-viz-controls button {
    padding: 8px 14px;
    font-size: 0.85em;
    min-width: auto;
}

.disk-viz-controls button.active {
    background: linear-gradient(135deg, var(--primary-accent), var(--secondary-accent));
    color: white;
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
}

.disk-viz-body {
    display: flex;
    align-items: flex-start;
    gap: 30px;
}

.disk-viz-canvas-wrap {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-width: 0;
}

.disk-viz-right-col {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: 750px;
}

.disk-viz-sector-info {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #60a5fa;
    border-radius: 8px;
    padding: 15px;
    min-height: 80px;
    font-family: inherit;
}

.disk-viz-legend {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 15px;
    flex: 1;
    overflow-y: auto;
}

.disk-viz-legend h3 {
    color: #94a3b8;
    margin-bottom: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 8px;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.legend-swatch {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
}

.legend-label {
    color: var(--text-main);
    font-family: inherit;
    font-size: 0.85em;
    font-weight: 500;
}

.legend-item:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15), rgba(37, 99, 235, 0.25));
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.legend-item.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3), rgba(37, 99, 235, 0.5));
    border-color: var(--primary-accent);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
}

.disk-viz-zoom-info {
    color: #94a3b8;
    font-family: inherit;
}

/* OS-9 Disk Map Stats */
.os9-map-stats {
    padding: 10px 14px;
    color: #94a3b8;
    font-size: 0.85em;
}

.os9-stat-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.os9-stat-row:last-child {
    border-bottom: none;
}

.os9-stat-label {
    color: #64748b;
    font-weight: 500;
}

.os9-stat-value {
    color: #e2e8f0;
    font-family: inherit;
}
