﻿/* модалка */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    pointer-events: none;
    padding: 20px;
}

    .modal-overlay.active {
        display: flex !important;
        pointer-events: auto;
    }

.modal-content {
    background: #1A1A1A;
    border-radius: 16px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    position: relative;
    border: 1px solid #2D2D2D;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-30px) scale(0.95);
        opacity: 0;
    }

    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid #2D2D2D;
    position: sticky;
    top: 0;
    background: #1A1A1A;
    z-index: 10;
    border-radius: 16px 16px 0 0;
}

.modal-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-icon {
    font-size: 24px;
    color: #F2E15F;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: #FFFFFF;
    margin: 0;
    font-family: 'Bebas Neue', sans-serif;
    letter-spacing: 1px;
}

.modal-close-btn {
    background: none;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: #B0B0B0;
    transition: all 0.3s ease;
}

    .modal-close-btn:hover {
        background: #2D2D2D;
        color: #FFFFFF;
    }

.modal-body {
    padding: 25px 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 30px;
    border-top: 1px solid #2D2D2D;
    background: #1A1A1A;
    border-radius: 0 0 16px 16px;
    position: sticky;
    bottom: 0;
}

.btn-modal {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-modal-secondary {
    background: #2D2D2D;
    color: #D4D4D4;
}

    .btn-modal-secondary:hover {
        background: #3D3D3D;
        transform: translateY(-2px);
    }

.btn-modal-primary {
    background: #F2E15F;
    color: #0D0D0D;
}

    .btn-modal-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 0 20px rgba(242, 225, 95, 0.5);
    }

/* поля */
.form-field {
    margin-bottom: 24px;
    padding: 0 30px;
}

.form-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #D4D4D4;
    margin-bottom: 8px;
}

    .form-label i {
        color: #F2E15F;
    }

    .form-label .required {
        color: #EF4444;
        margin-left: 2px;
    }

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #2D2D2D;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: #0D0D0D;
    color: #FFFFFF !important;
}

    .form-input::placeholder {
        color: #6B6B6B !important;
    }

    .form-input:focus {
        outline: none;
        border-color: #F2E15F;
        box-shadow: 0 0 0 3px rgba(242, 225, 95, 0.15);
    }

    .form-input:disabled {
        opacity: 0.4;
        cursor: not-allowed;
    }

    .form-input.input-error {
        border-color: #EF4444;
    }

        .form-input.input-error:focus {
            box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
        }

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23B0B0B0' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    background-color: #0D0D0D;
    color: #FFFFFF !important;
    cursor: pointer;
}

    .form-select option {
        background: #1A1A1A !important;
        color: #FFFFFF !important;
        padding: 10px !important;
    }

        .form-select option:hover, .form-select option:checked {
            background: #2D2D2D !important;
            color: #F2E15F !important;
        }

.form-textarea {
    resize: vertical;
    min-height: 80px;
    background: #0D0D0D;
    color: #FFFFFF !important;
}

    .form-textarea::placeholder {
        color: #6B6B6B !important;
    }

.modal-input-wrapper {
    position: relative;
}

    .modal-input-wrapper .validation-icon {
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 18px;
        display: none;
    }

    .modal-input-wrapper.valid .success-icon {
        display: block;
        color: #22C55E;
    }

    .modal-input-wrapper.invalid .error-icon {
        display: block;
        color: #EF4444;
    }

    .modal-input-wrapper.invalid .form-input {
        border-color: #EF4444;
    }

    .modal-input-wrapper.valid .form-input {
        border-color: #22C55E;
    }

.validation-message {
    font-size: 13px;
    color: #EF4444;
    margin-top: 4px;
    display: block;
    min-height: 20px;
}

/* ввод */
.input-row {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: center;
    margin-top: 8px;
    flex-wrap: wrap;
}

    .input-row .form-input {
        flex: 1;
        min-width: 80px;
    }

    .input-row .small-input {
        flex: 0.5;
        min-width: 80px;
        max-width: 120px;
    }

/* загрузка img */
.image-upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.image-upload-box {
    border: 2px dashed #2D2D2D;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    min-height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: #0D0D0D;
}

    .image-upload-box:hover {
        border-color: #F2E15F;
    }

.image-input-hidden {
    display: none;
}

.upload-area {
    width: 100%;
}

.upload-icon {
    font-size: 36px;
    color: #6B6B6B;
    display: block;
    margin-bottom: 8px;
}

.upload-text {
    font-size: 14px;
    color: #B0B0B0;
    display: block;
    margin-bottom: 8px;
}

.upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border: none;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 500;
    background: #F2E15F;
    color: #0D0D0D;
    cursor: pointer;
    transition: all 0.3s ease;
}

    .upload-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 0 15px rgba(242, 225, 95, 0.4);
    }

.file-info {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: #2D2D2D;
    border-radius: 6px;
    margin-top: 8px;
}

    .file-info i {
        color: #B0B0B0;
    }

    .file-info .file-name {
        font-size: 13px;
        color: #D4D4D4;
        flex: 1;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

.remove-file {
    background: none;
    border: none;
    color: #B0B0B0;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

    .remove-file:hover {
        background: rgba(239, 68, 68, 0.15);
        color: #EF4444;
    }

.image-preview-container {
    display: none;
    position: relative;
    width: 100%;
    max-height: 150px;
    overflow: hidden;
    border-radius: 6px;
    margin-top: 8px;
}

    .image-preview-container img {
        width: 100%;
        height: 100%;
        max-height: 150px;
        object-fit: contain;
        background: #1A1A1A;
    }

.preview-close {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(0,0,0,0.7);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

    .preview-close:hover {
        background: rgba(0,0,0,0.9);
        transform: scale(1.1);
    }

/* список работ (услуг) */
.works-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.work-item {
    display: flex;
    align-items: stretch;
    gap: 16px;
    padding: 16px 18px;
    background: var(--admin-input-bg);
    border-radius: 8px;
    border: 1px solid var(--admin-card-border);
    transition: all 0.3s ease;
    overflow: hidden;
}

    .work-item:hover {
        border-color: var(--admin-primary);
    }

.work-image-block {
    width: 80px;
    height: 80px;
    min-width: 80px;
    min-height: 80px;
    flex-shrink: 0;
    border-radius: 6px;
    overflow: hidden;
    background: var(--admin-card-border);
}

    .work-image-block img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: center;
        display: block;
    }

.work-info-block {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.work-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--admin-text);
    margin: 0;
}

.work-desc {
    font-size: 13px;
    color: var(--admin-text-muted);
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.work-status-badge {
    display: inline-block;
    font-size: 12px;
    margin-top: 2px;
}

.status-enabled {
    color: var(--admin-success);
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-disabled {
    color: var(--admin-text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.work-meta-block {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    gap: 8px;
    padding: 8px 0 0 0;
    border-top: 1px solid var(--admin-card-border);
    margin-top: 4px;
    width: 100%;
    flex-wrap: wrap;
}

.work-specs {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.spec-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--admin-text-secondary);
}

    .spec-item i {
        font-size: 14px;
        color: var(--admin-text-muted);
    }

.spec-value {
    font-weight: 500;
}

.spec-divider {
    width: 1px;
    height: 18px;
    background: var(--admin-card-border);
}

.work-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.btn-action {
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.btn-edit {
    background: var(--admin-primary-light);
    color: var(--admin-primary);
    border: 1px solid rgba(242, 225, 95, 0.15);
}

    .btn-edit:hover {
        background: var(--admin-primary);
        color: #0D0D0D;
        transform: scale(1.05);
        box-shadow: 0 0 15px rgba(242, 225, 95, 0.3);
    }

.btn-delete {
    background: rgba(239, 68, 68, 0.15);
    color: var(--admin-danger);
    border: 1px solid rgba(239, 68, 68, 0.15);
}

    .btn-delete:hover {
        background: var(--admin-danger);
        color: white;
        transform: scale(1.05);
        box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
    }

.admin-alert-error.custom-error {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 8px;
    margin: 20px 30px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #FCA5A5;
    font-size: 14px;
}

    .admin-alert-error.custom-error i {
        font-size: 20px;
        color: #EF4444;
        flex-shrink: 0;
    }

    .admin-alert-error.custom-error div {
        flex: 1;
    }

.modal-content::-webkit-scrollbar {
    width: 6px;
}

.modal-content::-webkit-scrollbar-track {
    background: #2D2D2D;
    border-radius: 0 0 4px 4px;
}

.modal-content::-webkit-scrollbar-thumb {
    background: #6B6B6B;
    border-radius: 3px;
}

    .modal-content::-webkit-scrollbar-thumb:hover {
        background: #B0B0B0;
    }

/* адаптация */
@media (min-width: 1220px) {
    .works-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 20px;
    }

    .work-item {
        flex-direction: column;
        align-items: stretch;
        padding: 20px;
        gap: 12px;
        min-height: 300px;
        border-radius: 12px;
    }

        .work-item:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
        }

    .work-image-block {
        width: 100%;
        height: 200px;
        min-width: unset;
        min-height: unset;
        border-radius: 8px;
    }

    .work-info-block {
        gap: 6px;
        flex: 1;
    }

    .work-title {
        font-size: 16px;
    }

    .work-desc {
        -webkit-line-clamp: 3;
        flex: 1;
        font-size: 13px;
    }

    .work-status-badge {
        margin-top: 4px;
    }

    .work-meta-block {
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 10px 0 0 0;
        border-top: 1px solid var(--admin-card-border);
        margin-top: 4px;
        width: 100%;
        gap: 10px;
    }

    .work-specs {
        display: flex;
        align-items: center;
        gap: 10px;
        flex-wrap: wrap;
    }

    .spec-divider {
        display: block;
    }

    .work-actions {
        display: flex;
        gap: 6px;
        flex-shrink: 0;
    }

    .btn-action {
        width: 34px;
        height: 34px;
        font-size: 14px;
        border-radius: 8px;
    }
}

@media (min-width: 768px) and (max-width: 1220px) {
    .works-list {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .work-item {
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
        gap: 10px;
        min-height: 260px;
        border-radius: 10px;
    }

        .work-item:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
        }

    .work-image-block {
        width: 100%;
        height: 170px;
        min-width: unset;
        min-height: unset;
        border-radius: 6px;
    }

    .work-info-block {
        gap: 4px;
        flex: 1;
    }

    .work-title {
        font-size: 15px;
    }

    .work-desc {
        -webkit-line-clamp: 2;
        font-size: 12px;
    }

    .work-status-badge {
        margin-top: 2px;
        font-size: 11px;
    }

    .work-meta-block {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        padding-top: 10px;
        border-top: 1px solid var(--admin-card-border);
        margin-top: 4px;
        width: 100%;
    }

    .work-specs {
        display: flex;
        justify-content: center;
        flex-direction: column;
        gap: 6px;
        flex-wrap: wrap;
        align-items: center;
    }

    .spec-item {
        font-size: 12px;
    }

    .spec-divider {
        display: none;
    }

    .work-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        width: 100%;
    }

        .work-actions .btn-action {
            width: 100% !important;
            height: 44px;
            font-size: 15px;
            border-radius: 8px;
            flex: none;
        }

            .work-actions .btn-action:only-child {
                grid-column: 1 / -1;
            }
}

@media (max-width: 767px) {
    .works-list {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .work-item {
        flex-direction: column;
        align-items: stretch;
        padding: 14px;
        gap: 10px;
        min-height: unset;
        overflow: hidden;
    }

    .work-image-block {
        width: 100%;
        height: 180px;
        min-width: unset;
        min-height: unset;
        flex-shrink: 0;
        border-radius: 6px;
    }

    .work-info-block {
        gap: 6px;
    }

    .work-title {
        font-size: 15px;
        text-align: center;
    }

    .work-desc {
        font-size: 13px;
        text-align: center;
        -webkit-line-clamp: 3;
    }

    .work-status-badge {
        text-align: center;
        display: block;
    }

    .status-enabled, .status-disabled {
        justify-content: center;
    }

    .work-meta-block {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding-top: 12px;
        border-top: 1px solid var(--admin-card-border);
    }

    .work-specs {
        display: flex;
        justify-content: center;
        gap: 6px;
        flex-wrap: wrap;
    }

    .spec-item {
        font-size: 12px;
    }

    .spec-divider {
        height: 14px;
        display: block;
    }

    .work-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        width: 100%;
    }

        .work-actions .btn-action {
            width: 100% !important;
            height: 48px;
            font-size: 16px;
            border-radius: 10px;
            flex: none;
        }

            .work-actions .btn-action:only-child {
                grid-column: 1 / -1;
            }
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
        margin: 10px;
        border-radius: 12px;
    }

    .modal-header {
        padding: 14px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .modal-header-left {
        gap: 8px;
    }

    .modal-icon {
        font-size: 20px;
    }

    .modal-title {
        font-size: 16px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 180px;
    }

    .modal-close-btn {
        width: 32px;
        height: 32px;
        font-size: 16px;
        flex-shrink: 0;
    }

    .modal-body {
        padding: 16px 0 !important;
    }

    .form-field {
        padding: 0 16px;
        margin-bottom: 18px;
    }

    .form-label {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .form-input {
        padding: 10px 14px;
        font-size: 13px;
    }

    .modal-footer {
        padding: 12px 16px;
        gap: 10px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .btn-modal {
        padding: 10px 20px;
        font-size: 13px;
        flex: 1;
        min-width: 100px;
        justify-content: center;
    }

    .input-row {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
    }

        .input-row .form-input {
            flex: 1;
            min-width: 60px;
            font-size: 13px;
            padding: 10px 12px;
        }

        .input-row .small-input {
            flex: 0.5;
            min-width: 70px;
            max-width: 100px;
            font-size: 13px;
            padding: 10px 12px;
        }

    .image-upload-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .image-upload-box {
        min-height: 100px;
        padding: 14px;
    }

    .upload-icon {
        font-size: 28px;
    }

    .upload-text {
        font-size: 13px;
    }

    .upload-btn {
        font-size: 12px;
        padding: 6px 16px;
    }

    .admin-alert-error {
        margin: 0 16px 16px 16px !important;
        padding: 12px 16px;
        font-size: 13px;
        flex-wrap: wrap;
    }

        .admin-alert-error i {
            font-size: 18px;
        }

    .form-select {
        font-size: 13px;
        padding: 10px 14px;
        padding-right: 32px;
        background-size: 10px;
    }
}

@media (max-width: 600px) {
    .input-row {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

        .input-row .form-input, .input-row .small-input {
            flex: none;
            width: 100%;
            max-width: 100%;
            min-width: unset;
            font-size: 12px;
            padding: 8px 10px;
        }

    .upload-btn {
        width: 100%;
        justify-content: center;
    }

    .admin-checkbox {
        padding: 2px 0;
    }

    .modal-content {
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 480px) {
    .modal-content {
        width: 98%;
        max-height: 98vh;
        margin: 5px;
        border-radius: 10px;
    }

    .modal-header {
        padding: 12px 14px;
    }

    .modal-title {
        font-size: 14px;
        max-width: 140px;
    }

    .modal-body {
        padding: 12px 0 !important;
    }

    .form-field {
        padding: 0 4px;
        margin-bottom: 14px;
    }

    .form-label {
        font-size: 12px;
        gap: 4px;
    }

    .form-input {
        padding: 8px 12px;
        font-size: 12px;
        border-radius: 6px;
    }

    .form-select {
        font-size: 12px;
        padding: 8px 12px;
        padding-right: 28px;
    }

    .modal-footer {
        padding: 10px 12px;
        gap: 8px;
        flex-direction: column;
    }

    .btn-modal {
        padding: 10px 16px;
        font-size: 12px;
        flex: none;
        width: 100%;
        justify-content: center;
    }

    .image-upload-box {
        min-height: 80px;
        padding: 10px;
    }

    .upload-icon {
        font-size: 24px;
    }

    .upload-text {
        font-size: 12px;
    }

    .upload-btn {
        font-size: 11px;
        padding: 5px 14px;
        width: 100%;
        justify-content: center;
    }

    .admin-checkbox {
        font-size: 12px;
        gap: 8px;
    }

        .admin-checkbox .checkmark {
            width: 18px;
            height: 18px;
            min-width: 18px;
            min-height: 18px;
        }

        .admin-checkbox input:checked + .checkmark::after {
            font-size: 12px;
        }

    .admin-alert-error {
        margin: 15px 12px 12px 12px !important;
        padding: 10px 14px;
        font-size: 12px !important;
    }

        .admin-alert-error i {
            font-size: 16px;
        }

    .modal-input-wrapper .validation-icon {
        right: 8px;
        font-size: 14px;
    }
    .work-btn-box {
        flex-direction: column;
    }
}

@media (max-width: 400px) {
    .spec-divider {
        display: none;
    }

    .work-specs {
        flex-direction: column;
        gap: 4px;
    }

    .work-image-block {
        height: 150px;
    }

    .admin-checkbox span {
        font-size: 12px;
    }

    .validation-message {
        font-size: 10px;
    }
}

@media (max-width: 380px) {
    .admin-alert-error {
        font-size: 10px !important;
    }
}

@media (max-width: 350px) {
    .admin-checkbox span {
        align-content: center;
        font-size: 9px;
    }
}
