/* ============================================
   Modal Styles
   ============================================ */

/* Base modal (hidden by default) */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
}

.modal:target,
.modal[aria-hidden="false"] {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Когда показываем модалку через класс .is-active (JS) */
.modal.is-active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Overlay */
.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
}

/* Dialog */
.modal-dialog {
    position: relative;
    z-index: 2001;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

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

/* Content */
.modal-content {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

/* Header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 20px;
    color: rgb(47, 47, 47);
    margin: 0;
}

.modal-close {
    font-size: 28px;
    color: #9ca3af;
    text-decoration: none;
    line-height: 1;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: rgb(47, 47, 47);
}

.modal-close--corner {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 32px;
    z-index: 10;
}

/* Body */
.modal-body {
    padding: 25px;
}

/* Footer */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    padding: 20px 25px;
    border-top: 1px solid #e5e7eb;
}

/* ============================================
   Modal Form Elements
   ============================================ */
.modal-form .form-group {
    margin-bottom: 20px;
}

.modal-form .form-label {
    font-family: 'Montserrat', sans-serif;
    font-weight: 500;
    font-size: 14px;
    color: rgb(47, 47, 47);
    display: block;
    margin-bottom: 8px;
}

.modal-form .form-input,
.modal-form .form-textarea,
.modal-form .form-select {
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: #fff;
    outline: none;
    transition: border-color 0.3s ease;
}

.modal-form .form-input:focus,
.modal-form .form-textarea:focus,
.modal-form .form-select:focus {
    border-color: #ac10ea;
}

.modal-form .form-textarea--large {
    min-height: 150px;
    resize: vertical;
}

.form-checkboxes-row {
    display: flex;
    gap: 20px;
}

/* ============================================
   Modal Buttons
   ============================================ */
.modal-btn {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 14px;
    padding: 12px 24px;
    border-radius: 6px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-btn--cancel {
    background-color: transparent;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.modal-btn--cancel:hover {
    background-color: #f3f4f6;
}

.modal-btn--submit {
    background-color: #ac10ea;
    color: #fff;
    border: none;
}

.modal-btn--submit:hover {
    background-color: #8a0dc2;
}

/* ============================================
   Modal "Новая работа" — выравнивание и отступы от краёв
   ============================================ */
#modal-add-work.modal--new-work .modal-dialog--new-work {
    max-width: 560px;
    width: calc(100% - 40px);
    margin: 20px;
    max-height: calc(100vh - 40px);
}

#modal-add-work.modal--new-work .modal-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    box-sizing: border-box;
    overflow: hidden;
}

#modal-add-work.modal--new-work .modal-header {
    flex-shrink: 0;
    padding: 20px 28px;
    border-bottom: 1px solid #e5e7eb;
}

#modal-add-work.modal--new-work .modal-title {
    font-size: 20px;
}

#modal-add-work.modal--new-work .modal-form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

#modal-add-work.modal--new-work .modal-body {
    flex: 1;
    overflow-y: auto;
    box-sizing: border-box;
    padding: 28px 28px;
}

#modal-add-work.modal--new-work .upload-zone {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    padding: 28px 24px;
    margin-bottom: 24px;
}

#modal-add-work.modal--new-work .upload-zone__content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 100%;
}

#modal-add-work.modal--new-work .upload-zone__icon {
    margin-bottom: 12px;
}

#modal-add-work.modal--new-work .upload-zone__title {
    margin-bottom: 8px;
}

#modal-add-work.modal--new-work .upload-zone__formats {
    margin-bottom: 14px;
}

#modal-add-work.modal--new-work .upload-zone__btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    background-color: #ac10ea;
    color: #fff;
    border: none;
}

#modal-add-work.modal--new-work .form-group {
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 20px;
}

#modal-add-work.modal--new-work .form-group:last-of-type {
    margin-bottom: 0;
}

#modal-add-work.modal--new-work .form-label {
    display: block;
    width: 100%;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: rgb(47, 47, 47);
}

#modal-add-work.modal--new-work .form-input,
#modal-add-work.modal--new-work .form-textarea {
    width: 100% !important;
    max-width: 100%;
    box-sizing: border-box !important;
    padding: 12px 15px !important;
    margin: 0 !important;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background-color: #fff;
}

#modal-add-work.modal--new-work .form-textarea {
    min-height: 80px;
    resize: vertical;
}

#modal-add-work.modal--new-work .form-checkboxes-row {
    width: 100%;
    box-sizing: border-box;
    margin-top: 20px;
    gap: 20px;
}

#modal-add-work.modal--new-work .modal-footer {
    flex-shrink: 0;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 28px;
    border-top: 1px solid #e5e7eb;
}

#modal-add-work.modal--new-work .modal-btn {
    padding: 12px 24px;
    font-size: 14px;
}

#modal-add-work.modal--new-work .form-checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

#modal-add-work.modal--new-work .form-checkbox-group input[type="checkbox"] {
    width: auto;
    margin: 0;
    flex-shrink: 0;
}

#modal-add-work.modal--new-work .checkbox-label {
    margin: 0;
    font-weight: 500;
    font-size: 14px;
    color: rgb(47, 47, 47);
}

/* ============================================
   Upload Zone
   ============================================ */
.upload-zone {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 30px;
    text-align: center;
    margin-bottom: 25px;
    transition: border-color 0.3s ease, background-color 0.3s ease;
    box-sizing: border-box;
}

.upload-zone:hover {
    border-color: #ac10ea;
    background-color: #faf5ff;
}

.upload-zone__icon {
    width: 48px;
    height: 48px;
    margin-bottom: 15px;
    opacity: 0.6;
}

.upload-zone__title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 16px;
    color: rgb(47, 47, 47);
    margin: 0 0 10px;
}

.upload-zone__formats {
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    color: #6b7280;
    margin: 0 0 15px;
}

.upload-zone__btn {
    display: inline-block;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 14px;
    padding: 10px 20px;
    background-color: #ac10ea;
    color: #fff;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.upload-zone__btn:hover {
    background-color: #8a0dc2;
}

/* ============================================
   Post Attachments
   ============================================ */
.post-attachments {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.attachment-slot {
    flex: 1;
}

.attachment-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100px;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.attachment-btn:hover {
    border-color: #ac10ea;
    background-color: #faf5ff;
}

.attachment-icon {
    font-size: 24px;
    color: #9ca3af;
    margin-bottom: 5px;
}

.attachment-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    color: #9ca3af;
}

/* ============================================
   Work View Modal
   ============================================ */
.modal-content--view {
    padding: 0;
    overflow: hidden;
}

.work-view {
    display: flex;
    min-height: 500px;
}

.work-view__image {
    flex: 1;
    background-color: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
}

.work-view__img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
}

.work-view__info {
    flex: 0 0 320px;
    padding: 25px;
    background-color: #fff;
    display: flex;
    flex-direction: column;
}

.work-view__actions {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 15px;
}

.work-action {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.work-action a {
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    color: #6b7280;
    text-decoration: none;
}

.work-action a:hover {
    color: #ac10ea;
}

.work-view__title {
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 22px;
    color: rgb(47, 47, 47);
    margin: 0 0 10px;
}

.work-view__tags {
    margin: 0 0 15px;
}

.work-tag {
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    color: #ac10ea;
    margin-right: 8px;
    text-decoration: none;
}

.work-tag:hover {
    text-decoration: underline;
}

.work-view__description {
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    color: rgb(47, 47, 47);
    line-height: 1.5;
    margin: 0 0 20px;
}

/* Author section */
.work-view__author {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: auto;
}

.work-author__avatar img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.work-author__info {
    flex: 1;
}

.work-author__name {
    margin: 0;
}

.work-author__name a {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 15px;
    color: rgb(47, 47, 47);
    text-decoration: none;
}

.work-author__name a:hover {
    color: #ac10ea;
}

.work-author__link {
    margin: 5px 0 0;
}

.work-author__link a {
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    color: #6b7280;
    text-decoration: none;
}

.work-author__link a:hover {
    color: #ac10ea;
}

.work-view__stats {
    display: flex;
    gap: 10px;
}

.work-stat-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid #e5e7eb;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.work-stat-btn:hover {
    border-color: #ac10ea;
    background-color: #faf5ff;
}

/* Navigation */
.work-view__nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding-top: 20px;
}

.work-nav-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.work-nav-btn:hover {
    opacity: 1;
}

.work-nav__counter {
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    color: rgb(47, 47, 47);
    margin: 0;
}

/* ============================================
   Visually Hidden
   ============================================ */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .modal-dialog {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal--large .modal-dialog {
        max-width: none;
    }
    
    .work-view {
        flex-direction: column;
    }
    
    .work-view__image {
        min-height: 200px;
    }
    
    .work-view__info {
        flex: none;
    }
    
    .post-attachments {
        flex-direction: column;
    }
    
    .attachment-btn {
        height: 80px;
    }
    
    .form-checkboxes-row {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .modal-header {
        padding: 15px 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 15px 20px;
        flex-direction: column;
    }
    
    .modal-btn {
        width: 100%;
        text-align: center;
    }
    
    .upload-zone {
        padding: 20px;
    }
    
    .modal--new-work .modal-dialog--new-work {
        width: 95%;
        margin: 0 auto;
    }
    
    .modal--new-work .form-checkboxes-row {
        flex-direction: column;
    }
}
