/* Podstawowe style */
body {
    font-family: Helvetica, sans-serif;
    max-width: 900px;
    margin: 2rem auto 4rem;
    padding: 0 1rem;
    line-height: 1.4;
}
h1,
p {
    text-align: center;
    margin-bottom: 1rem;
}

/* Kontrolki */
.control-box {
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 0.5rem 1rem;
}
#controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
#orientation label {
    margin-right: 1rem;
}

/* Podgląd obrazów */
#preview {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
    /* Center items when vertical */
    align-items: center;
    transition: background-color 0.2s;
}
.img-wrapper {
    position: relative;
    border: 1px solid #ccc;
    border-radius: 8px;
    overflow: hidden;
    flex: 1 1 calc(33% - 1rem);
    max-width: calc(50% - 1rem);
}
.img-wrapper canvas {
    display: block;
    width: 100%;
    height: auto;
}
.img-number {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 4px;
}

/* Przyciski w podglądzie */
.rotate-btn,
.delete-btn,
.up-btn,
.down-btn {
    position: absolute;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: background-color 0.2s;
}
.rotate-btn:hover,
.delete-btn:hover,
.up-btn:hover,
.down-btn:hover {
    background-color: #f0f0f0;
}
.rotate-btn {
    top: 4px;
    right: 4px;
}
.delete-btn {
    bottom: 4px;
    right: 4px;
}
.up-btn {
    bottom: 4px;
    left: 4px;
}
.down-btn {
    bottom: 4px;
    left: 4px;
    transform: translateY(-28px);
}

/* Pobierz */
#download-btn {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    background: #28a745;
    color: #fff;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    cursor: pointer;
    z-index: 1000;
    transition: background-color 0.2s;
}
#download-btn:hover {
    background-color: #218838;
}

/* Modal fullscreen */
#modal.hidden {
    display: none;
}
#modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
#modal-content {
    position: relative;
    max-width: 60%;
    max-height: 90%;
}
@media only screen and (max-width: 600px) {
    #modal-content {
        max-width: 90%;
    }
}

#modal-content img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
}
#modal-close {
    position: absolute;
    top: -12px;
    right: -12px;
    background: #fff;
    border: none;
    border-radius: 4px;
    padding: 4px 12px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s;
}
#modal-close:hover {
    background-color: #f0f0f0;
}

/* Drag-over indicator */
#preview.drag-hover {
    outline: 2px dashed blue;
    border-radius: 8px;
    background-color: rgba(0, 0, 255, 0.1);
}
