:root {
    --bg: #f5f6fa;
    --card-bg: #ffffff;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --text: #1f2937;
    --border: #d1d5db;
    --muted: #6b7280;
    --danger: #dc2626;
}

* {
    box-sizing: border-box;
    font-family: "Segoe UI", "Malgun Gothic", sans-serif;
}

body {
    margin: 0;
    padding: 20px;
    background: var(--bg);
    color: var(--text);
}

header {
    text-align: center;
    margin-bottom: 20px;
}

header h1 {
    margin: 0 0 5px;
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 12px;
}

.form-row label {
    font-weight: 600;
    align-self: center;
}

.form-row input[type="text"],
.form-row input[type="file"] {
    flex: 1;
    min-width: 160px;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.form-row button,
.actions button {
    background: var(--primary);
    border: none;
    color: white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.form-row button:hover,
.actions button:hover {
    background: var(--primary-dark);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 10px;
}

.actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.actions #delete-btn {
    background: var(--danger);
}

.table-container {
    overflow-x: auto;
}

.selection-details {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 10px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}

th {
    background: #eef2ff;
    font-weight: 600;
}

tbody tr {
    cursor: pointer;
}

tbody tr:hover {
    background: #f1f5f9;
}

tbody tr.selected {
    background: #dbeafe;
}

#selected-info {
    margin-bottom: 12px;
    color: var(--muted);
}

#freq-chart {
    max-height: 360px;
    margin-bottom: 20px;
}

#status-message {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: var(--primary);
    color: #fff;
    padding: 10px 16px;
    border-radius: 8px;
    display: none;
    box-shadow: 0 10px 25px rgba(15, 23, 42, 0.2);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.35);
    z-index: 10;
}

.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 11;
}

.modal-card {
    background: var(--card-bg);
    padding: 20px;
    border-radius: 12px;
    width: min(500px, 90vw);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.3);
}

.modal-card h3 {
    margin-top: 0;
    margin-bottom: 8px;
}

.modal-card p {
    margin-top: 0;
    color: var(--muted);
}

.checkbox-row {
    flex-direction: column;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 16px;
}

.modal-actions button.secondary {
    background: #6b7280;
}

.hidden {
    display: none;
}

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
    }

    .form-row input[type="text"] {
        width: 100%;
    }
}
#files-table input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.more-btn {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: #fff;
    cursor: pointer;
    font-size: 12px;
}

.more-btn:hover {
    background: #eef2ff;
}

.selection-row td {
    background: #f8fafc;
}
