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

html {
    touch-action: manipulation;
}

body {
    font-family: 'Malgun Gothic', '맑은 고딕', sans-serif;
    background-color: #f5f5f5;
    padding: 20px;
    touch-action: pan-x pan-y pinch-zoom;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: #2c3e50;
    color: white;
}

.header h1 {
    font-size: 1.5rem;
}

.mode-indicator {
    display: flex;
    align-items: center;
    gap: 15px;
}

.super-badge {
    background: #e74c3c;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: bold;
}

.normal-badge {
    background: #27ae60;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.edit-hint {
    font-size: 0.85rem;
    color: #bdc3c7;
}

.save-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: background 0.3s;
}

.save-btn:hover {
    background: #2980b9;
}

.save-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.reset-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: bold;
    transition: background 0.3s;
}

.reset-btn:hover {
    background: #c0392b;
}

.table-container {
    overflow: auto;
    max-height: calc(100vh - 180px);
    padding: 10px;
    touch-action: pan-x pan-y pinch-zoom;
}

/* Mobile: remove overflow constraints for proper pinch zoom */
@media (max-width: 768px) {
    .table-container {
        overflow: visible;
        max-height: none;
    }

    .container {
        max-width: 100%;
        overflow: visible;
    }
}

/* Excel Table Styles */
.excel-table {
    border-collapse: collapse;
    font-size: 11px;
    background: white;
    table-layout: fixed;
    border: 2px solid #000;
}

.excel-table td {
    border: 1px solid #c0c0c0;
    padding: 2px 4px;
    vertical-align: middle;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #000000;
    background-color: #ffffff;
}

/* Cells with explicit borders from Excel override the default */
.excel-table td[style*="border-top"],
.excel-table td[style*="border-bottom"],
.excel-table td[style*="border-left"],
.excel-table td[style*="border-right"] {
    /* Explicit borders take precedence */
}

.excel-table td.editable {
    background-color: #fffde7 !important;
    cursor: pointer;
    position: relative;
}

.excel-table td.editable:hover {
    background-color: #fff9c4 !important;
    outline: 2px solid #f39c12;
    outline-offset: -2px;
}

.excel-table td.editing {
    padding: 0;
    background-color: #fff !important;
}

.excel-table td.editing input {
    width: 100%;
    height: 100%;
    border: none;
    outline: none;
    padding: 2px 4px;
    font-size: 11px;
    font-family: inherit;
    background: #e3f2fd;
}

.cell-value {
    display: block;
    width: 100%;
    height: 100%;
}

.cell-checkbox {
    cursor: pointer;
    transform: scale(1.3);
    margin-right: 5px;
}

.cell-checkbox:disabled {
    cursor: not-allowed;
}

/* Checkbox cell styling */
.checkbox-cell {
    text-align: center !important;
    vertical-align: middle !important;
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 5px;
}

.checkbox-label {
    font-size: 11px;
    white-space: nowrap;
}

/* Hidden columns (W and beyond) - always hidden */
.hidden-col {
    display: none !important;
    visibility: collapse !important;
    width: 0 !important;
}

/* Footer */
.footer {
    padding: 15px 20px;
    background: #ecf0f1;
    text-align: center;
}

.super-link, .normal-link {
    color: #3498db;
    text-decoration: none;
    font-size: 0.9rem;
}

.super-link:hover, .normal-link:hover {
    text-decoration: underline;
}

/* Toast Notification */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 12px 30px;
    border-radius: 5px;
    font-size: 0.95rem;
    z-index: 1000;
    transition: opacity 0.3s, visibility 0.3s;
}

.toast.hidden {
    opacity: 0;
    visibility: hidden;
}

.toast.success {
    background: #27ae60;
}

.toast.error {
    background: #e74c3c;
}

/* Scrollbar styling */
.table-container::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

.table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.table-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 5px;
}

.table-container::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Print styles */
@media print {
    .header, .footer {
        display: none;
    }

    .table-container {
        max-height: none;
        overflow: visible;
    }

    .excel-table td.editable {
        background-color: white !important;
    }
}
