/* ===============================================
   VREYA - STILI MODAL STANDARD
   Stili uniformi per tutti i modal del sistema
   =============================================== */

/* STRUTTURA BASE MODAL */
.modal,
.modal-overlay {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(2px);
    align-items: center;
    justify-content: center;
}

.modal.show,
.modal.active,
.modal-overlay[style*="display: flex"] {
    display: flex !important;
}

/* CONTENUTO MODAL */
.modal-content,
.modal-container {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
}

.modal-large {
    max-width: 900px;
}

.modal-xlarge {
    max-width: 1200px;
}

/* HEADER */
.modal-header {
    padding: 24px 28px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, #ffffff, #fafafa);
    flex-shrink: 0;
}

.modal-header h2,
.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.02em;
}

.modal-close {
    background: #f3f4f6;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
    font-weight: 300;
}

.modal-close:hover {
    background: #e5e7eb;
    color: #111827;
    transform: scale(1.05);
}

/* BODY */
.modal-body {
    padding: 28px;
    overflow-y: auto;
    flex: 1;
}

/* SEZIONI DETTAGLI */
.dettagli-section {
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid #f3f4f6;
}

.dettagli-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.dettagli-section h4 {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 16px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* GRID DETTAGLI */
.dettagli-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.dettaglio-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.dettaglio-label {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.dettaglio-value {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
}

/* Dettaglio item con form elements */
.dettaglio-item label.dettaglio-label {
    margin-bottom: 6px;
    display: block;
}

.dettaglio-item input,
.dettaglio-item select,
.dettaglio-item textarea {
    margin-top: 0;
}

/* FORM GROUPS */
.form-group {
    margin-bottom: 24px;
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    color: #111827;
    background: white;
    transition: all 0.2s ease;
    font-family: inherit;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(45, 90, 61, 0.1);
}

.form-input::placeholder {
    color: #9ca3af;
}

/* PULSANTI STANDARD */
.btn,
.btn-primary,
.btn-secondary,
.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-family: inherit;
}

.btn svg,
.btn-primary svg,
.btn-secondary svg,
.btn-danger svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--color-dark);
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(45, 90, 61, 0.2);
}

.modal .btn-secondary,
.modal-overlay .btn-secondary,
.modal-content .btn-secondary {
    background: white;
    color: #374151;
    border: 1.5px solid #e5e7eb;
}

.modal .btn-secondary:hover,
.modal-overlay .btn-secondary:hover,
.modal-content .btn-secondary:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #111827;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.2);
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.25);
}

.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-warning:hover {
    background: #d97706;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

/* FOOTER MODAL */
.modal-footer {
    padding: 20px 28px;
    border-top: 1px solid #e5e7eb;
    background: #fafafa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-left: auto;
}

/* TEXTAREA & INPUT */
textarea {
    resize: vertical;
    min-height: 100px;
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
}

textarea:focus,
.modal input:focus,
.modal select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(105, 109, 216, 0.1);
}

/* FOOTER AZIONI */
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    background: #fafafa;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }

    .modal-header {
        padding: 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .dettagli-grid {
        grid-template-columns: 1fr;
    }

    .modal-footer {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }
}

/* ===============================================
   MODAL ALBUM - GRIGLIA FOTO
   =============================================== */
.album-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 16px;
}

.album-photo-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s ease;
}

.album-photo-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
}

.album-photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-remove-photo {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 32px;
    height: 32px;
    background: rgba(239, 68, 68, 0.95);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    line-height: 1;
    backdrop-filter: blur(4px);
}

.album-photo-item:hover .btn-remove-photo {
    opacity: 1;
}

.btn-remove-photo:hover {
    background: #dc2626;
    transform: scale(1.08);
}

.add-photo-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: white;
    border: 2px dashed #d1d5db;
    transition: all 0.2s ease;
    cursor: pointer;
}

.add-photo-btn:hover {
    border-color: var(--color-primary);
    background: rgba(45, 90, 61, 0.02);
}

.add-photo-btn svg {
    color: var(--color-primary);
    opacity: 0.6;
}

.add-photo-btn:hover svg {
    opacity: 1;
}

.add-photo-btn span {
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
}

.count-badge {
    display: inline-block;
    background: var(--color-primary);
    color: white;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 12px;
    font-weight: 600;
    margin-left: 8px;
}

.modal-footer .btn-danger {
    margin-right: auto;
}

/* ===============================================
   COVER UPLOAD
   =============================================== */
.cover-upload {
    position: relative;
    width: 220px;
    height: 220px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #e5e7eb;
    transition: all 0.2s ease;
}

.cover-upload:hover {
    border-color: var(--color-primary);
    box-shadow: 0 8px 16px rgba(0,0,0,0.08);
}

.cover-upload img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.btn-change-cover {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
}

.cover-upload:hover .btn-change-cover {
    opacity: 1;
}

.btn-change-cover:hover {
    background: rgba(0,0,0,0.95);
    transform: translateX(-50%) translateY(-2px);
}

/* ===============================================
   EPISODES / LESSONS LIST
   =============================================== */
.episodes-list,
.lessons-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.episode-item,
.lesson-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: white;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.episode-item:hover,
.lesson-item:hover {
    border-color: #d1d5db;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.episode-number,
.lesson-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--color-primary);
    color: white;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.form-input-small {
    width: 100px !important;
    flex-shrink: 0;
}

.btn-remove-episode,
.btn-remove-lesson {
    width: 32px;
    height: 32px;
    background: rgba(239, 68, 68, 0.08);
    color: #ef4444;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.btn-remove-episode:hover,
.btn-remove-lesson:hover {
    background: #ef4444;
    color: white;
    transform: scale(1.05);
}

.btn-add-episode,
.btn-add-lesson {
    background: white;
    border: 2px dashed #d1d5db;
    color: var(--color-primary);
    padding: 14px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 4px;
    width: 100%;
}

.btn-add-episode:hover,
.btn-add-lesson:hover {
    border-color: var(--color-primary);
    background: rgba(45, 90, 61, 0.02);
}
