body {
    font-family: 'Arial', sans-serif;
    background-color: #f4f4f4;
    margin: 0;
    padding: 20px;
    color: #333;
}
h1 {
    text-align: center;
    color: #4CAF50;
    margin-bottom: 30px;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    background-color: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
}
.input-section {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
input[type="text"] {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}
select {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}
button {
    padding: 10px 20px;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.3s;
}
button:hover {
    background-color: #45a049;
}
.archive-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}
.archive-header h2 {
    margin: 0;
    color: #4CAF50;
}
.archive-header p {
    margin: 0;
    color: #666;
    font-size: 14px;
}
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}
tbody tr {
    border-bottom: 1px solid #ddd;
}
th, td {
    padding: 12px;
    text-align: center;
    border-bottom: none;
    min-width: 50px;
    vertical-align: middle;
}
th {
    background-color: #f2f2f2;
    font-weight: bold;
    color: #333;
}
tr:hover {
    background-color: #f5f5f5;
}
.download-btn {
    padding: 6px 12px;
    background-color: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}
.download-btn:hover {
    background-color: #0b7dda;
}

.download-btn.loading {
    background-color: #aaa;
    cursor: not-allowed;
}

.sub-label {
    display: block;   /* ⬅️ 줄바꿈 */
    font-size: 14px;
    margin-top: 2px;
}

.date-cell {
    text-align: center;     /* 전체 중앙 */
    line-height: 1.3;
}

.date-cell span {
    display: inline-block;  /* 한 덩어리 취급 */
    white-space: nowrap;    /* 날짜/시간 안 쪼개짐 */
    font-size: 14px;
    color: #555;
}

.extract {
    min-width: 80px;
}

.format-selectors {
    display: inline-flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-text-short {
    display: none;
}

td[data-label="제목"],
td[data-label="화질"] {
    font-weight: bold;
}

.extract.locked {
    background-color: #aaa;   /* 회색 */
    cursor: not-allowed;
    opacity: 0.7;
}

.extract.locked:hover {
    background-color: #aaa;   /* hover 무효 */
}

.extract.loading::before {
    content: "";
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.5);
    border-top-color: #fff;
    border-radius: 50%;
    display: inline-block;
    margin-right: 6px;
    animation: spin 0.8s linear infinite;
}

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

/* =========================
    Mobile Responsive Table
   ========================= */
@media (max-width: 768px) {

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

    /* 입력 영역 세로 정렬 */
    .input-section {
        flex-direction: column;
        align-items: stretch;
    }

    .input-section input,
    .input-section select,
    .input-section button {
        width: 100%;
    }

    /* 테이블 → 카드 형태 */
    table, thead, tbody, th, tr {
        display: block;
        width: 100%;
    }

    thead {
        display: none;
    }

    tr {
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 10px;
        padding: 12px;
        margin-bottom: 15px;
        box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    }

    tr:hover {
        background: #fff;
    }

    td {
        display: flex;
        justify-content: right;
        align-items: center;
        padding: 6px 0;
        border: none;
        font-size: 14px;
    }

    td::before {
        content: attr(data-label);
        font-weight: bold;
        color: #666;
        margin-right: 10px;
        flex-shrink: 0;
    }

    /* 제목 + 화질 강조 */
    td[data-label="제목"],
    td[data-label="화질"] {
        font-size: 15px;
        font-weight: bold;
        padding-top: 2px;
        padding-bottom: 2px;
        padding-right: 10%;
    }

    td[data-label="제목"]::before,
    td[data-label="화질"]::before {
        display: none;
    }

    td[data-label="제목"] {
        padding-left: 10%;
        padding-right: 0;
        justify-content: flex-start;

        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;

        max-width: 90%;

        -webkit-mask-image: linear-gradient(
            to right,
            black 90%,
            transparent 100%
        );
        mask-image: linear-gradient(
            to right,
            black 90%,
            transparent 100%
        );
    }

    td:has(.download-btn) {
        justify-content: center;
    }

    .download-btn {
        width: 80%;
        font-size: 14px;
        padding: 8px 0;
    }

    .archive-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .format-selectors select {
        width: auto !important;
        min-width: 80px;
        flex: 1;
    }

    td.date-cell {
        justify-content: flex-end;
        text-align: right;
        gap: 6px;
        padding-right: 10%;
    }

    td.date-cell::before {
        display: none;
    }

    .btn-text-full {
        display: none;
    }
    .btn-text-short {
        display: inline;
    }
}

/* =========================
    End of Mobile Responsive Table
   ========================= */