html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
    padding: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
}

body.modal-open {
    overflow: hidden;
    padding: 0;
}

.container {
    width: 100%;
    max-width: 480px;
    padding: 10px 15px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
    box-sizing: border-box;
}

.logo {
    width: 20px;
}

h1 {
    text-align: center;
    font-size: 1.3rem;
    margin-bottom: 12px;
}

.upload-container {
    width: 100%;
    padding: 17px 12px;
    margin-bottom: 3px;
    background-color: #f8f9fa;
    border: 2px dashed #ccc;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    transition: border 0.2s ease-in-out;
    box-sizing: border-box;
}

.upload-container:hover {
    border-color: #5e1914;
}

.upload-icon {
    font-size: 32px;
}

.upload-text {
    font-size: 1rem;
    color: #333;
    margin-top: 8px;
    font-weight: bold;
}

.upload-subtext {
    font-size: 0.8rem;
    color: #888;
    margin-top: 3px;
}

#fileInput {
    display: none;
}

.file-name {
    margin-top: 5px;
    margin-bottom: 5px;
    font-size: 0.85rem;
    color: #333;
    font-weight: bold;
    word-break: break-all;
    min-height: 0;
    transition: all 0.2s ease;
}

.file-name:empty {
    margin: 0;
    min-height: 0;
}

.button {
    width: 100%;
    padding: 8px;
    background-color: #5e1914;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.95rem;
    margin-top: 10px;
}

.button:hover {
    background-color: #420d09;
}

.button:disabled {
    background-color: #d3d3d3;
    cursor: not-allowed;
}

.countdown {
    font-size: 0.9rem;
    color: red;
    text-align: center;
    margin-top: 8px;
}

#progressContainer {
    display: none;
    margin-top: 10px;
    width: 100%;
    height: 6px;
    background-color: #ddd;
    border-radius: 5px;
    text-align: center;
    margin-bottom: 10px;
}

#progressBar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #5e1914, #ff5733);
    border-radius: 5px;
    transition: width 0.3s ease-in-out;
}

#progressPercent {
    text-align: center;
    font-weight: bold;
    margin-top: 3px;
    color: #333;
    font-size: 0.8rem;
}

/* Result Section Styles */
.result-section {
    margin-top: 15px;
    padding: 12px;
    background-color: #f0fff4;
    border: 2px solid #48bb78;
    border-radius: 8px;
    text-align: center;
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 5px;
}

.result-icon {
    font-size: 18px;
}

.result-title {
    font-size: 0.95rem;
    font-weight: bold;
    color: #276749;
}

.result-filename {
    font-size: 0.85rem;
    color: #666;
    margin-top: 2px;
    margin-bottom: 6px;
    padding: 5px 10px;
    word-break: break-all;
}

.result-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.button-secondary {
    padding: 8px 16px;
    background-color: white;
    color: #5e1914;
    border: 2px solid #5e1914;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: bold;
    transition: all 0.2s ease-in-out;
}

.button-secondary:hover {
    background-color: #5e1914;
    color: white;
}

.result-actions .button {
    width: auto;
    padding: 10px 20px;
    margin-top: 0;
    font-size: 0.9rem;
}

/* Fullscreen Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: #1a1a1a;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.modal-container {
    width: 100%;
    height: 100%;
    flex: 1;
    background-color: white;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background-color: #5e1914;
    color: white;
    flex-shrink: 0;
    height: 40px;
    min-height: 40px;
    max-height: 40px;
    box-sizing: border-box;
}

.modal-header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 70%;
}

.modal-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.modal-btn {
    width: 28px;
    height: 28px;
    border: none;
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
    line-height: 1;
    padding: 0;
}

.modal-btn:hover {
    background-color: white;
    color: #5e1914;
}

.modal-close {
    font-size: 20px;
}

.modal-body {
    flex: 1;
    padding: 0;
    margin: 0;
    overflow: hidden;
    background-color: #f5f5f5;
    height: calc(100% - 40px);
    min-height: 0;
}

/* Table Loading */
.table-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    font-size: 18px;
    color: #666;
}

/* Table Container */
.table-container {
    width: 100%;
    height: 100%;
    overflow: auto;
    display: none;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    background-color: white;
}

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 100;
}

.data-table thead::before {
    content: '';
    position: absolute;
    top: -5px;
    left: 0;
    right: 0;
    height: 5px;
    background-color: #5e1914;
}

.data-table th {
    background-color: #5e1914;
    color: white;
    padding: 12px 10px;
    text-align: center;
    font-weight: 600;
    border: 1px solid #4a1410;
    white-space: nowrap;
    position: relative;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.data-table td {
    padding: 10px;
    border: 1px solid #ddd;
    background-color: white;
}

.data-table td a {
    display: block;
    text-align: center;
    color: #0066cc;
    text-decoration: underline;
}

.data-table tbody tr:nth-child(even) td {
    background-color: #f9f9f9;
}

.data-table tbody tr:hover td {
    background-color: #fff3f3;
}

/* ========== RESPONSIVE DESIGN ========== */

/* Large Desktop (1200px+) */
@media screen and (min-width: 1200px) {
    body {
        padding: 40px;
    }
    
    .container {
        max-width: 550px;
        padding: 30px;
    }
    
    .logo {
        width: 150px;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    .upload-container {
        padding: 30px;
    }
    
    .upload-icon {
        font-size: 50px;
    }
    
    .upload-text {
        font-size: 1.25rem;
    }
}

/* Tablet Landscape (992px - 1199px) */
@media screen and (min-width: 992px) and (max-width: 1199px) {
    .container {
        max-width: 500px;
    }
}

/* Tablet Portrait (768px - 991px) */
@media screen and (min-width: 768px) and (max-width: 991px) {
    body {
        padding: 30px;
    }
    
    .container {
        max-width: 480px;
        padding: 20px;
    }
    
    .logo {
        width: 110px;
    }
    
    .upload-container {
        padding: 25px 20px;
    }
}

/* Mobile Landscape / Small Tablet (576px - 767px) */
@media screen and (min-width: 576px) and (max-width: 767px) {
    body {
        padding: 20px;
    }
    
    .container {
        max-width: 90%;
        padding: 20px;
    }
    
    .logo {
        width: 100px;
    }
    
    h1 {
        font-size: 1.3rem;
    }
    
    .upload-container {
        padding: 25px 15px;
    }
    
    .upload-icon {
        font-size: 35px;
    }
    
    .upload-text {
        font-size: 1rem;
    }
    
    .modal-header h2 {
        font-size: 12px;
        max-width: 60%;
    }
    
    .data-table {
        font-size: 12px;
    }
    
    .data-table th,
    .data-table td {
        padding: 8px 6px;
    }
}

/* Mobile Portrait (up to 575px) */
@media screen and (max-width: 575px) {
    body {
        padding: 10px;
        align-items: flex-start;
    }
    
    .container {
        width: 100%;
        max-width: 100%;
        padding: 15px;
        border-radius: 0;
        box-shadow: none;
        min-height: auto;
    }
    
    .logo {
        width: 80px;
        margin-bottom: 5px;
    }
    
    h1 {
        font-size: 1.2rem;
        margin: 8px 0;
    }
    
    .upload-container {
        padding: 20px 10px;
        margin: 10px 0;
    }
    
    .upload-icon {
        font-size: 30px;
    }
    
    .upload-text {
        font-size: 0.95rem;
        margin-top: 10px;
    }
    
    .upload-subtext {
        font-size: 0.75rem;
    }
    
    .file-name {
        font-size: 0.8rem;
        margin-top: 8px;
        margin-bottom: 10px;
    }
    
    .button {
        padding: 10px;
        font-size: 0.9rem;
        margin-top: 10px;
    }
    
    .countdown {
        font-size: 0.85rem;
    }
    
    .result-section {
        margin-top: 12px;
        padding: 12px;
    }
    
    .result-header {
        gap: 5px;
    }
    
    .result-icon {
        font-size: 18px;
    }
    
    .result-title {
        font-size: 0.9rem;
    }
    
    .result-filename {
        font-size: 0.75rem;
        margin-bottom: 10px;
    }
    
    .result-actions {
        flex-direction: column;
        gap: 8px;
    }
    
    .result-actions .button,
    .button-secondary {
        width: 100%;
        padding: 10px 15px;
        font-size: 0.85rem;
    }
    
    /* Modal adjustments for mobile */
    .modal-header {
        padding: 6px 10px;
        height: 36px;
        min-height: 36px;
        max-height: 36px;
    }
    
    .modal-header h2 {
        font-size: 11px;
        max-width: 55%;
    }
    
    .modal-btn {
        width: 24px;
        height: 24px;
        font-size: 14px;
    }
    
    .modal-close {
        font-size: 18px;
    }
    
    .modal-controls {
        gap: 5px;
    }
    
    .data-table {
        font-size: 11px;
    }
    
    .data-table th {
        padding: 8px 5px;
        font-size: 10px;
    }
    
    .data-table td {
        padding: 6px 5px;
    }
}

/* Extra small devices (up to 360px) */
@media screen and (max-width: 360px) {
    .container {
        padding: 10px;
    }
    
    .logo {
        width: 70px;
    }
    
    h1 {
        font-size: 1.1rem;
    }
    
    .upload-text {
        font-size: 0.85rem;
    }
    
    .upload-icon {
        font-size: 25px;
    }
    
    .button {
        font-size: 0.85rem;
    }
}