/**
 * Fotogalerie - čtvercová mřížka s inline editací
 */

/* Upload area */
.photo-uploader {
    margin-bottom: 2rem;
}

.upload-area {
    border: 2px dashed var(--color-border);
    border-radius: 16px;
    min-height: 180px;
    padding: 1.5rem;
    text-align: center;
    background: var(--color-bg-light);
    color: var(--color-text-light);
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-area::before {
    display: none;
}

.upload-area:hover::before,
.upload-area.dragover::before {
    border-color: var(--color-primary, #c9a97e);
}

.upload-area:hover,
.upload-area.dragover {
    border-color: var(--color-gold);
    background: var(--color-bg);
    color: var(--color-text);
    box-shadow: none;
}

.upload-area i {
    font-size: 2.4rem;
    line-height: 1;
    color: var(--color-gold);
    margin-bottom: 0.15rem;
    display: block;
    transition: transform 0.2s ease;
}

.upload-area:hover i,
.upload-area.dragover i {
    transform: scale(1.04);
}

.upload-area p {
    margin: 0;
    color: inherit;
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 600;
    text-align: center;
    line-height: 1.5;
}

.upload-area .upload-btn {
    color: var(--color-gold);
    text-decoration: none;
    cursor: pointer;
    font-weight: 600;
    border-bottom: 0;
    transition: opacity 0.2s ease;
}

.upload-area .upload-btn:hover {
    opacity: 0.8;
}

.upload-area small {
    color: var(--color-text-light);
    font-size: 0.75rem;
    display: block;
    margin-top: 0.35rem;
}

.upload-prompt {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
}

/* Progress */
.upload-progress {
    padding: 1.5rem;
}

.progress-bar {
    background: var(--color-bg-light, #f3f4f6);
    border-radius: 8px;
    height: 8px;
    overflow: hidden;
    margin-bottom: 0.75rem;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.progress-fill {
    background: linear-gradient(90deg, var(--color-primary, #c9a97e), var(--color-accent, #a88a6a));
    height: 100%;
    width: 0;
    transition: width 0.4s ease;
    animation: progress-pulse 1.5s infinite;
    border-radius: 8px;
}

@keyframes progress-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

.progress-text {
    color: var(--color-text, #1f2937);
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
}

/* Photo grid - čtvercová mřížka */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

@media (max-width: 600px) {
    .photo-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
}

/* Photo item */
.photo-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    background: #f5f5f5;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.photo-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.15);
}

.photo-item.dragging {
    opacity: 0.5;
    transform: scale(1.05);
}

/* Photo link a obrázek */
.photo-link {
    display: block;
    width: 100%;
    height: 100%;
}

.photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.photo-item:hover img {
    transform: scale(1.05);
}

/* Akční tlačítka */
.photo-actions {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 8px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.7) 0%, transparent 100%);
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.photo-item:hover .photo-actions {
    opacity: 1;
}

.photo-actions span {
    width: 30px;
    height: 30px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.photo-actions span:hover {
    background: var(--primary-color, #007bff);
    color: white;
}

.drag-handle {
    cursor: grab;
}

.drag-handle:active {
    cursor: grabbing;
}

.drag-handle svg {
    width: 16px;
    height: 16px;
    display: block;
}

.delete-photo:hover {
    background: #e74c3c !important;
    color: white !important;
}

/* Caption */
.photo-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
    color: white;
    font-size: 12px;
    line-height: 1.3;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.photo-item:hover .photo-caption {
    opacity: 1;
}

/* Inline edit popisu */
.photo-desc-edit {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    background: rgba(255,255,255,0.95);
    border-top: 1px solid #eee;
    z-index: 10;
}

.photo-desc-edit input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 8px;
    box-sizing: border-box;
}

.photo-desc-edit input:focus {
    border-color: var(--primary-color, #007bff);
    outline: none;
}

.photo-desc-edit button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    margin-right: 5px;
}

.photo-desc-edit .save-desc {
    background: var(--primary-color, #007bff);
    color: white;
    font-weight: 600;
}

.photo-desc-edit .save-desc:hover {
    background: var(--primary-dark, #0056b3);
}

.photo-desc-edit .cancel-desc {
    background: #eee;
    color: #666;
}

.photo-desc-edit .cancel-desc:hover {
    background: #ddd;
}

/* Dokumenty */

.page-documents__item.dragging {
    opacity: 0.5;
    transform: scale(1.02);
}

.page-documents__item {
    position: relative;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Document extension badge */
.doc-extension {
    color: var(--color-text-light, #9ca3af);
    font-size: 0.85em;
    font-weight: 500;
    margin-left: 0.35rem;
}

/* Document actions */
.document-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.document-actions span {
    width: 28px;
    height: 28px;
    background: rgba(0,0,0,0.05);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 12px;
}

.document-actions span:hover {
    background: var(--primary-color, #007bff);
    color: white;
}

.document-actions .drag-handle {
    cursor: grab;
}

.document-actions .drag-handle:active {
    cursor: grabbing;
}

.document-actions .drag-handle svg {
    width: 14px;
    height: 14px;
    display: block;
}

.document-actions .delete-document:hover {
    background: #e74c3c !important;
    color: white !important;
}

/* Inline edit názvu dokumentu */
.doc-title-edit {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    padding: 10px;
    background: white;
    border: 1px solid #eee;
    border-radius: 4px;
    margin-top: 5px;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.doc-title-edit input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 8px;
    box-sizing: border-box;
}

.doc-title-edit input:focus {
    border-color: var(--primary-color, #007bff);
    outline: none;
}

.doc-title-edit button {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    margin-right: 5px;
}

.doc-title-edit .save-title {
    background: var(--primary-color, #007bff);
    color: white;
    font-weight: 600;
}

.doc-title-edit .save-title:hover {
    background: var(--primary-dark, #0056b3);
}

.doc-title-edit .cancel-title {
    background: #eee;
    color: #666;
}

.doc-title-edit .cancel-title:hover {
    background: #ddd;
}
