html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f0f0f0;
    padding: 20px;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    box-sizing: border-box;
}

body.modal-open {
    overflow: hidden;
    padding: 0;
}

.container {
    width: 35%;
    padding: 30px;
    background-color: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.logo {
    width: 120px;
    margin-bottom: -10px;
}

h1 {
    text-align: center;
}

/* Auth Section Styles */
.auth-section {
    margin: 15px 0 20px 0;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 8px;
    text-align: center;
}

/* Mode Tabs */
.mode-tabs {
    display: flex;
    gap: 10px;
    margin: 15px 0 20px 0;
    justify-content: center;
}

.mode-tab {
    flex: 1;
    padding: 12px 20px;
    background-color: #f0f0f0;
    border: 2px solid #ddd;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #666;
    transition: all 0.2s ease;
}

.mode-tab:hover {
    background-color: #e8e8e8;
    border-color: #5e1914;
    color: #5e1914;
}

.mode-tab.active {
    background-color: #5e1914;
    border-color: #5e1914;
    color: white;
}

.auth-text {
    color: #666;
    margin-bottom: 15px;
    font-size: 14px;
}

.login-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    background: linear-gradient(180deg, #5e1914 0%, #420d09 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: bold;
    transition: all 0.2s ease-in-out;
}

.login-button:hover {
    background: linear-gradient(180deg, #7a2520 0%, #5e1914 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(94, 25, 20, 0.3);
}

.ms-icon {
    font-size: 18px;
}

#userInfo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.user-greeting {
    color: #333;
    font-size: 14px;
}

.user-greeting strong {
    color: #5e1914;
}

.logout-link {
    color: #666;
    font-size: 13px;
    text-decoration: none;
    padding: 5px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    transition: all 0.2s;
}

.logout-link:hover {
    color: #5e1914;
    border-color: #5e1914;
}

.upload-container {
    width: 100%;
    padding: 40px;
    margin: 20px 0;
    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: 50px;
}

.upload-text {
    font-size: 22px;
    color: #333;
    margin-top: 20px;
    font-weight: bold;
}

.upload-subtext {
    font-size: 14px;
    color: #888;
    margin-top: 7px;
}

#fileInput {
    display: none;
}

.file-name {
    margin-top: 15px;
    margin-bottom: 20px;
    font-size: 16px;
    color: #333;
    font-weight: bold;
}

.button {
    display: block;
    width: 100%;
    padding: 10px;
    background-color: #5e1914;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 20px;
}

.button:hover {
    background-color: #420d09;
}

.button:disabled {
    background-color: #d3d3d3;
    cursor: not-allowed;
}

.countdown {
    font-size: 18px;
    color: red;
    text-align: center;
    margin-top: 10px;
}

#progressContainer {
    display: none;
    margin-top: 20px;
    width: 100%;
    height: 10px;
    background-color: #ddd;
    border-radius: 5px;
    text-align: center;
    margin-bottom: 25px;
}

#progressBar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #5e1914, #ff5733);
    border-radius: 5px;
    transition: width 0.3s ease-in-out;
    padding-bottom: 5px;
}

#progressPercent {
    text-align: center;
    font-weight: bold;
    margin-top: 5px;
    color: #333;
}

/* Label and Dropdown Styles */
.label {
    font-size: 16px;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    text-align: left;
    padding-top: 10px;
}

.dropdown {
    width: 100%;
    padding: 12px 15px;
    font-size: 16px;
    color: #333;
    background-color: #f8f9fa;
    border: 2px solid #ccc;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235e1914' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    box-sizing: border-box;
}

.dropdown:hover {
    border-color: #5e1914;
}

.dropdown:focus {
    outline: none;
    border-color: #5e1914;
    box-shadow: 0 0 0 3px rgba(94, 25, 20, 0.15);
}

.dropdown option {
    padding: 10px;
    background-color: white;
    color: #333;
}

/* Loading Indicator */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-top: 20px;
    gap: 10px;
    color: #5e1914;
    font-weight: bold;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f0f0f0;
    border-top: 4px solid #5e1914;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error Message */
.error-message {
    margin-top: 15px;
    padding: 12px 15px;
    background-color: #fff5f5;
    border: 1px solid #fc8181;
    border-radius: 8px;
    color: #c53030;
    font-size: 14px;
    text-align: center;
}

/* 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: 6px 12px;
    background-color: #5e1914;
    color: white;
    flex-shrink: 0;
    height: 36px;
    min-height: 36px;
    max-height: 36px;
    box-sizing: border-box;
}

.modal-header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.modal-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.modal-controls .button-secondary {
    background-color: transparent;
    color: white;
    border-color: rgba(255,255,255,0.5);
    padding: 4px 10px;
    font-size: 11px;
}

.modal-controls .button-secondary:hover {
    background-color: white;
    color: #5e1914;
    border-color: white;
}

/* Modal header buttons (reload & close) */
.modal-btn {
    width: 26px;
    height: 26px;
    border: none;
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 18px;
    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-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal-close {
    font-size: 20px;
    padding-top: 2px;
}

.modal-reload {
    font-size: 16px;
}

.modal-reload.loading {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.modal-body {
    flex: 1;
    padding: 0;
    margin: 0;
    overflow: hidden;
    background-color: #f5f5f5;
    height: calc(100% - 36px);
    min-height: 0;
}

.excel-embed {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    margin: 0;
    padding: 0;
}

/* Keep old embed container styles for reference but not used */
.embed-container {
    display: none;
}

.excel-embed {
    width: 100%;
    height: 100%;
    border: none;
}

/* Table Container */
.table-container {
    width: 90%;
    max-width: 1400px;
    margin: 30px auto;
    padding: 20px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.table-header h2 {
    margin: 0;
    color: #333;
    font-size: 20px;
}

.table-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.search-input {
    padding: 10px 15px;
    font-size: 14px;
    border: 2px solid #ccc;
    border-radius: 8px;
    min-width: 200px;
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.search-input:focus {
    outline: none;
    border-color: #5e1914;
    box-shadow: 0 0 0 3px rgba(94, 25, 20, 0.15);
}

.button-secondary {
    padding: 10px 20px;
    background-color: white;
    color: #5e1914;
    border: 2px solid #5e1914;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s ease-in-out;
}

.button-secondary:hover {
    background-color: #5e1914;
    color: white;
}

/* Table Wrapper for Scrolling */
.table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.table-wrapper.mobile-scroll {
    -webkit-overflow-scrolling: touch;
}

/* Data Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table th {
    background: linear-gradient(180deg, #5e1914 0%, #420d09 100%);
    color: white;
    padding: 14px 12px;
    text-align: left;
    font-weight: bold;
    white-space: nowrap;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.data-table th:last-child {
    border-right: none;
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.data-table th.sortable:hover {
    background: linear-gradient(180deg, #7a2520 0%, #5e1914 100%);
}

/* Sort Indicators */
.data-table th.sort-asc::after {
    content: ' ▲';
    font-size: 10px;
}

.data-table th.sort-desc::after {
    content: ' ▼';
    font-size: 10px;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #e2e8f0;
    border-right: 1px solid #e2e8f0;
}

.data-table td:last-child {
    border-right: none;
}

.data-table tbody tr:hover {
    background-color: rgba(94, 25, 20, 0.05);
}

.data-table tbody tr:nth-child(even) {
    background-color: #f8f9fa;
}

.data-table tbody tr:nth-child(even):hover {
    background-color: rgba(94, 25, 20, 0.08);
}

/* Number cells align right */
.data-table td.number-cell {
    text-align: right;
    font-family: 'Consolas', 'Monaco', monospace;
}

/* Density Classes */
.data-table.density-low th,
.data-table.density-low td {
    padding: 16px 20px;
    font-size: 15px;
}

.data-table.density-medium th,
.data-table.density-medium td {
    padding: 12px 15px;
    font-size: 14px;
}

.data-table.density-high th,
.data-table.density-high td {
    padding: 8px 10px;
    font-size: 13px;
}

/* Table Footer */
.table-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
    color: #666;
    font-size: 14px;
}

/* Responsive Adjustments */
@media screen and (max-width: 768px) {
    body {
        height: auto;
        min-height: 100vh;
        padding: 20px 0;
    }

    .container {
        width: 90%;
        margin: 0 auto;
    }

    .table-container {
        width: 95%;
        padding: 15px;
        margin: 20px auto;
    }

    .table-header {
        flex-direction: column;
        align-items: stretch;
    }

    .table-controls {
        flex-direction: column;
    }

    .search-input {
        width: 100%;
        min-width: unset;
    }

    .button-secondary {
        width: 100%;
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px;
        font-size: 12px;
    }
}

@media screen and (max-width: 480px) {
    .logo {
        width: 100px;
    }

    h1 {
        font-size: 20px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 6px;
        font-size: 11px;
    }
}