/* MediaValet CDN Insert Page Styles */

.mediavalet-url-container {
    padding: 20px;
    max-width: 100%;
}

.mediavalet-url-section {
    margin-bottom: 20px;
}

.mediavalet-url-input {
    width: 100%;
    max-width: 600px;
    padding: 8px;
    font-size: 14px;
}

.mediavalet-picker-btn {
    margin-top: 10px;
    padding: 8px 15px;
    background: #2271b1;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 3px;
}

.mediavalet-picker-btn:hover {
    background: #135e96;
}

.mediavalet-insert-btn {
    margin-top: 15px;
    padding: 10px 20px;
    background: #2271b1;
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 3px;
    font-size: 14px;
}

.mediavalet-insert-btn:hover {
    background: #135e96;
}

.mediavalet-insert-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* ---- Custom picker modal (plain iframe, no wp.components.Modal) ---- */

#mediavalet-picker-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 100000;
}

#mediavalet-picker-content {
    position: absolute;
    top: 5%;
    left: 5%;
    width: 90%;
    height: 90%;
    background: white;
    border-radius: 5px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.mediavalet-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    height: 48px;
    background: #1d2327;
    flex-shrink: 0;
}

.mediavalet-picker-title {
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
}

.mediavalet-picker-close {
    background: none;
    border: none;
    color: #ffffff;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 4px 8px;
    border-radius: 3px;
}

.mediavalet-picker-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

#mediavalet-picker-frame {
    flex: 1;
    width: 100%;
    border: none;
    display: block;
}

#mediavalet-picker-loading {
    position: absolute;
    top: 48px;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #fff;
    z-index: 1;
    color: #646970;
    font-size: 13px;
}

#mediavalet-picker-loading p {
    margin: 0;
}

.mv-picker-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #dcdcde;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: mv-spin 0.8s linear infinite;
    margin-bottom: 12px;
}

@keyframes mv-spin {
    to { transform: rotate(360deg); }
}

/* WordPress-style notices */
.mediavalet-notice {
    position: relative;
    padding: 12px 15px;
    margin: 15px 0;
    border-left: 4px solid;
    background: #fff;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.mediavalet-notice-success {
    border-left-color: #00a32a;
}

.mediavalet-notice-error {
    border-left-color: #d63638;
}

.mediavalet-notice-success .dashicons {
    color: #00a32a;
}

.mediavalet-notice-error .dashicons {
    color: #d63638;
}

.mediavalet-notice .dashicons {
    vertical-align: middle;
    margin-right: 8px;
}

.mediavalet-notice-dismiss {
    position: absolute;
    top: 0;
    right: 1px;
    padding: 9px;
    border: none;
    background: none;
    color: #787c82;
    cursor: pointer;
}

.mediavalet-notice-dismiss:hover {
    color: #d63638;
}

/* Custom Success Dialog */
#mediavalet-success-dialog {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 100001;
    align-items: center;
    justify-content: center;
}

#mediavalet-success-dialog.show {
    display: flex;
}

.mediavalet-dialog-content {
    background: white;
    border-radius: 4px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    animation: dialogSlideIn 0.2s ease-out;
}

@keyframes dialogSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.mediavalet-dialog-header {
    padding: 16px 20px;
    border-bottom: 1px solid #dcdcde;
    display: flex;
    align-items: center;
    background: #f6f7f7;
}

.mediavalet-dialog-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1d2327;
}

.mediavalet-dialog-body {
    padding: 20px;
    font-size: 14px;
    line-height: 1.6;
    color: #2c3338;
}

.mediavalet-dialog-footer {
    padding: 16px 20px;
    border-top: 1px solid #dcdcde;
    text-align: right;
    background: #f6f7f7;
}

.mediavalet-dialog-btn {
    padding: 8px 24px;
    background: #2271b1;
    color: white;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.1s ease;
}

.mediavalet-dialog-btn:hover {
    background: #135e96;
}

.mediavalet-dialog-btn:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* ── wp.media custom picker frame ── */

/* Unify UI iframe fill — shown inside wp.media content region */
.mv-unify-wrap {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
}

.mv-unify-wrap iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.mv-picker-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.mv-search-bar {
    padding: 8px 16px;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
}

.mv-search-bar .mv-search {
    width: 100%;
    padding: 6px 10px;
    font-size: 13px;
    border: 1px solid #8c8f94;
    border-radius: 3px;
    box-sizing: border-box;
}

.mv-grid-wrap {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    position: relative;
    min-height: 200px;
}

.mv-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.mv-asset-item {
    width: 120px;
    background: #f6f7f7;
    border: 2px solid transparent;
    border-radius: 3px;
    cursor: pointer;
    padding: 4px;
    box-sizing: border-box;
    outline: none;
}

.mv-asset-item:hover {
    border-color: #2271b1;
}

.mv-asset-item.selected {
    border-color: #2271b1;
    background: #e8f0fb;
}

.mv-asset-item .attachment-preview .thumbnail {
    width: 100%;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #e0e0e0;
}

.mv-asset-item .attachment-preview .thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mv-asset-item .attachment-info {
    padding: 4px 0 0;
}

.mv-asset-item .attachment-info .filename {
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mv-asset-item .attachment-info .uploaded {
    font-size: 10px;
    color: #646970;
}

.mv-msg {
    padding: 12px 16px;
    color: #646970;
}

.mv-loading {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
}

.mv-loading .mv-loading-text {
    color: #646970;
    font-size: 13px;
}

.mv-no-thumb {
    font-size: 36px;
    color: #8c8f94;
}
