body {
    margin: 0;
    font-family: Arial, sans-serif;
}

.container {
    display: flex;
}

#header {
    background: #333;
    color: white;
    padding: 20px;
    text-align: center;
    font-weight: bold;
    font-size: 1.5em;
    width: 100%;
    box-sizing: border-box;
    border-radius: 4px 4px 0 0;
}

#sidebar {
    display: grid;
    grid-auto-rows: 1fr;
    width: 50px;
    background: #f0f0f0;
    min-height: 100%;
    border-left: 1px solid #ddd;
}

.sidebar-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    /* padding: 15px; */
    text-align: center;
    border-bottom: 1px solid #ddd;
    background: #e9e9e9;
    font-weight: bold;
    /* min-height: 110px; */
    box-sizing: border-box;
}

#main-table-container {
    flex: 1;
    overflow: auto;
    background: #ddd;
    border-right: 1px solid #ddd;
    border-left: 1px solid #ddd;
}

#main-table {
    display: grid;
    grid-template-columns: repeat(var(--columns, 8), minmax(120px, 1fr));
    grid-auto-rows: 1fr;
    gap: 1px;
    min-height: 100%;
}

.table-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    aspect-ratio: 1.2 / 1;
    background: hsl(0, 0%, 100%);
    cursor: pointer;
    box-sizing: border-box;
    text-align: center;
    position: relative;
    transition: 0.1s;
}

.table-cell:hover {
    background-color: hsl(0, 0%, 85%);
    transition: 0.1s;
}

.table-cell.selected {
    background-color: hsl(159, 70%, 75%);
    transition: 0.1s;
}

.table-cell.selected:hover {
    background-color: hsl(159, 70%, 60%);
    transition: 0.1s;
}

.table-cell.filler-cell {
    background-color: #f9f9f9;
    cursor: default;
    pointer-events: none;
}

.cell-image {
    max-width: 100%;
    max-height: 50%;
    margin-bottom: 8px;
    object-fit: contain;
}

.cell-title {
    font-size: 0.9em;
    word-break: break-word;
}

#footer {
    background: #333;
    color: white;
    padding: 15px;
    text-align: center;
    font-size: 1.5em;
    width: 100%;
    box-sizing: border-box;
    font-weight: bold;
    border-radius: 0 0 4px 4px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#footer-left {
    text-align: left;
    flex: 1;
    padding-left: 10px;
    font-size: small;
    color: hsl(0, 0%, 75%);
}

#footer-center {
    text-align: center;
    flex: 1;
}

#footer-right {
    text-align: right;
    flex: 1;
    padding-right: 10px;
    font-size: small;
    color: hsl(0, 0%, 75%);
}

.button-container {
    display: flex;
}

#button-container.single-button {
    justify-content: center;
}

#button-container.single-button #download-btn {
    margin-left: 0;
    margin-right: 0;
}

#download-btn {
    display: block;
    margin: 20px auto;
    padding: 12px 24px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    cursor: pointer;
    transition: 0.3s;
}

#download-btn:hover {
    background: #45a049;
    transition: 0.3s;
}

#clipboard-btn {
    display: block;
    margin: 20px auto;
    padding: 12px 24px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1em;
    cursor: pointer;
    transition: 0.3s;
}

#clipboard-btn:hover {
    background: #6D8F9E;
    transition: 0.3s;
}

#capture-container {
    display: block;
    max-width: 1550px;
    margin: 20px auto 0;
    padding: 0;
    box-sizing: border-box;
    font-size: smaller;
    transition: 1s;
    user-select: none;
    border-radius: 4px;
    background: transparent !important;
}

#capture-container.capturing {
    box-shadow: 0 0 0 3px #4CAF50;
    transition: 0.1s;
}

#capture-container.capturing #header,
#capture-container.capturing #footer {
    width: var(--screenshot-width, 100%) !important;
    min-width: 100% !important;
    box-sizing: border-box;
}

#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.98);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.3s ease;
}

.loading-spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1.5s linear infinite;
    margin-bottom: 15px;
}

.loading-text {
    font-size: 1.2em;
    color: #333;
    font-weight: bold;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
