/* =============================================================
   KloPi Photos Management — Styles for the photo admin page
   Reuses PIN overlay and base styles from pages.css / style.css
   ============================================================= */

/* =============================================================
   Upload area — dashed border box for file selection
   ============================================================= */

.upload-area {
    background: #0d1117;
    border: 2px dashed #30363d;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    transition: border-color 0.2s;
}

.upload-area.drag-over {
    border-color: #58a6ff;
    background: #161b22;
}

/* Hide the native file input — styled via the label instead */
.file-input {
    display: none;
}

/* Styled label acts as the file picker button */
.upload-label {
    display: inline-block;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    color: #58a6ff;
    background: #161b22;
    border: 2px solid #30363d;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    font-family: inherit;
}

.upload-label:hover {
    background: #21262d;
    border-color: #58a6ff;
}

/* Preview of selected file before upload */
.upload-preview {
    margin-top: 12px;
    font-size: 13px;
    color: #8b949e;
    word-break: break-all;
}

.upload-preview img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 8px;
    margin-top: 8px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Upload button — green, appears after file selection */
.btn-upload {
    display: block;
    width: 100%;
    margin-top: 12px;
    padding: 14px;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    background: #238636;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
    font-family: inherit;
}

.btn-upload:hover:not(:disabled) {
    background: #2ea043;
}

.btn-upload:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Progress/status text during upload */
.upload-progress {
    margin-top: 10px;
    font-size: 13px;
    color: #8b949e;
    min-height: 20px;
}

.upload-progress.error {
    color: #f85149;
}

.upload-progress.success {
    color: #3fb950;
}

/* =============================================================
   Settings group — random mode configuration
   ============================================================= */

.settings-group {
    background: #161b22;
    border: 2px solid #30363d;
    border-radius: 12px;
    padding: 14px;
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}

.settings-row + .settings-row {
    border-top: 1px solid #21262d;
}

.settings-label {
    font-size: 14px;
    color: #e6edf3;
    white-space: nowrap;
}

.settings-select {
    padding: 8px 32px 8px 12px;
    font-size: 14px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 8px;
    color: #e6edf3;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b949e' fill='none' stroke-width='2'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.settings-select:focus {
    border-color: #58a6ff;
}

/* Toggle switch for random enabled */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.toggle-input {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background: #30363d;
    border-radius: 12px;
    transition: background-color 0.2s;
    flex-shrink: 0;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #8b949e;
    border-radius: 50%;
    transition: transform 0.2s, background-color 0.2s;
}

.toggle-input:checked + .toggle-slider {
    background: #238636;
}

.toggle-input:checked + .toggle-slider::after {
    transform: translateX(20px);
    background: #ffffff;
}

.toggle-text {
    font-size: 14px;
    color: #e6edf3;
}

/* =============================================================
   Photo grid — responsive grid of thumbnail cards
   ============================================================= */

.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 10px;
}

.photo-card {
    background: #161b22;
    border: 2px solid #30363d;
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.photo-card:hover {
    border-color: #484f58;
}

/* Thumbnail image */
.photo-card img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    display: block;
}

/* Info area below the thumbnail */
.photo-info {
    padding: 8px 10px;
}

.photo-filename {
    font-size: 11px;
    color: #8b949e;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 6px;
}

/* Mode selector dropdown */
.photo-mode-select {
    width: 100%;
    padding: 6px 28px 6px 8px;
    font-size: 12px;
    background: #0d1117;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #e6edf3;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238b949e' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    margin-bottom: 6px;
}

.photo-mode-select:focus {
    border-color: #58a6ff;
}

/* Delete button */
.btn-photo-delete {
    width: 100%;
    padding: 6px;
    font-size: 11px;
    font-weight: 600;
    color: #f85149;
    background: none;
    border: 1px solid #30363d;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    font-family: inherit;
}

.btn-photo-delete:hover {
    background: #2d1215;
    border-color: #da3633;
}

/* Photo count badge next to section header */
.photo-count {
    font-size: 13px;
    color: #8b949e;
    font-weight: 400;
}

/* Empty state message */
.no-photos {
    color: #484f58;
    font-style: italic;
    font-size: 14px;
    text-align: center;
    padding: 30px 0;
}
