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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.5;
}

.admin-wrap {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid #ddd;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.admin-header h1 {
    font-size: 1.3rem;
    font-weight: 600;
}

.admin-header nav {
    display: flex;
    gap: 0.5rem;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    color: #333;
    text-decoration: none;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn:hover { background: #eee; }

.btn-primary {
    background: #2563eb;
    border-color: #2563eb;
    color: #fff;
}

.btn-primary:hover { background: #1d4ed8; }

.btn-danger {
    color: #dc2626;
    border-color: #dc2626;
}

.btn-danger:hover { background: #fef2f2; }


/* Gallery list */
.gallery-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.gallery-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.gallery-info h2 {
    font-size: 1rem;
    font-weight: 600;
}

.gallery-meta {
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.2rem;
}

.gallery-actions {
    display: flex;
    gap: 0.5rem;
}

.status {
    display: inline-block;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 0.3rem;
}

.status-aktivní { background: #dcfce7; color: #166534; }
.status-skrytá { background: #fef3c7; color: #92400e; }
.status-expirovaná { background: #fee2e2; color: #991b1b; }

.empty {
    color: #888;
    text-align: center;
    padding: 3rem;
}

/* Edit form */
.admin-section {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 1.25rem;
    margin-bottom: 1.5rem;
}

.admin-section h2 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
}

.admin-section form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.admin-section label {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
    font-weight: 500;
    gap: 0.25rem;
}

.admin-section label small {
    font-weight: 400;
    color: #888;
}

.admin-section input[type="text"],
.admin-section input[type="number"],
.admin-section input[type="password"] {
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 0.9rem;
}


label.checkbox {
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
}

.field-info {
    font-size: 0.8rem;
    color: #666;
    margin-bottom: 0.5rem;
}

/* Messages */
.msg {
    background: #dcfce7;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
}

.msg-error {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

.error {
    color: #dc2626;
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

/* Log output */
.log-output {
    margin-top: 1rem;
    max-height: 300px;
    overflow-y: auto;
    font-family: monospace;
    font-size: 0.8rem;
    background: #1a1a1a;
    color: #4ade80;
    padding: 0.75rem;
    border-radius: 4px;
}

.log-output:empty { display: none; }
.log-output:not(:empty) { margin-bottom: 1.5rem; }
.log-output p { margin: 0.15rem 0; }
.log-output .error { color: #f87171; }


/* Files grid (visual file manager) */
.admin-wide {
    max-width: 1200px;
}

.files-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

#selected-count {
    font-size: 0.8rem;
    color: #666;
}

.files-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 6px;
}

.file-tile {
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
    border: 2px solid transparent;
    transition: border-color 0.15s;
}

.file-tile.selected {
    border-color: #2563eb;
}

.file-tile.selected .file-tile-check {
    opacity: 1;
}

.file-tile-inner {
    position: relative;
    aspect-ratio: 1;
    background: #eee;
    overflow: hidden;
}

.file-tile-inner img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.file-tile-icon {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #999;
}

.file-tile-check {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: #2563eb;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.15s;
}

.file-tile-num {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-size: 0.6rem;
    padding: 1px 5px;
    border-radius: 3px;
}

.file-tile.file-hidden {
    opacity: 0.4;
}

.file-tile.file-hidden .file-tile-name {
    text-decoration: line-through;
}

.file-tile:hover .file-tile-check {
    opacity: 0.5;
}
}

.file-tile-name {
    font-size: 0.65rem;
    padding: 3px 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    color: #555;
}

@media (max-width: 480px) {
    .files-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Upload dropzone */
.dropzone {
    border: 2px dashed #ccc;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    color: #888;
    transition: border-color 0.2s, background 0.2s;
}

.dropzone.dragover {
    border-color: #2563eb;
    background: #eff6ff;
}

.dropzone p {
    margin: 0.25rem 0;
}

.dropzone-sub {
    font-size: 0.8rem;
}

/* Upload progress */
.upload-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 1rem;
    font-size: 0.8rem;
    color: #666;
}

.upload-progress:empty { display: none; }

.progress-bar {
    flex: 1;
    height: 6px;
    background: #e5e5e5;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: #2563eb;
    transition: width 0.2s;
}

/* Upload list */
.upload-list {
    margin-top: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.upload-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.8rem;
}

.upload-item.upload-error .upload-size {
    color: #dc2626;
}

.upload-thumb {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 3px;
}

.upload-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.upload-size {
    color: #888;
    white-space: nowrap;
}

.host-builder {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.host-builder input {
    width: 140px;
}

.domain-btns {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

/* Login */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.login-form {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.login-form input {
    padding: 0.5rem 1rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 1rem;
}

.login-form button {
    padding: 0.5rem 1.5rem;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
}

@media (max-width: 600px) {
    .gallery-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .admin-header {
        flex-direction: column;
        align-items: flex-start;
    }
}
