/* Font Faces - Local Montserrat */
@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/Montserrat-Regular.woff2') format('woff2'),
        url('../fonts/Montserrat-Regular.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/Montserrat-Medium.woff2') format('woff2'),
        url('../fonts/Montserrat-Medium.woff') format('woff');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Montserrat';
    src: url('../fonts/Montserrat-SemiBold.woff2') format('woff2'),
        url('../fonts/Montserrat-SemiBold.woff') format('woff');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

:root {
    --mp-primary: #111827;
    --mp-accent: #6366f1;
    --mp-accent-hover: #4f46e5;
    --mp-danger: #ef4444;
    --mp-success: #10b981;
    --mp-warning: #f59e0b;
    --mp-bg: #f3f4f6;
    --mp-card-bg: #ffffff;
    --mp-text: #1f2937;
    --mp-text-muted: #6b7280;
    --mp-border: #e5e7eb;
    --mp-radius-lg: 12px;
    --mp-radius-md: 8px;
    --mp-radius-sm: 6px;
    --mp-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --mp-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.masspost-admin-wrap {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--mp-text);
    /* background-color: var(--mp-bg); */
    margin: 0 auto;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
    max-width: 1100px;
    font-size: 14px;
    /* Reduced base size */
    line-height: 1.5;
}

.masspost-admin-wrap * {
    box-sizing: border-box;
}

/* Header */
.masspost-header {
    background: transparent;
    padding: 32px 0;
    text-align: center;
}

.masspost-header img {
    height: 40px;
    /* Reduced logo size */
    width: auto;
    margin-bottom: 16px;
    display: inline-block;
}

.masspost-header h1 {
    font-size: 24px;
    /* Reduced header size */
    font-weight: 600;
    color: var(--mp-primary);
    margin: 0 0 8px 0;
    letter-spacing: -0.02em;
    display: none;
    /* Hide H1 logic if logo present, or keep small */
}

.masspost-subtitle {
    font-size: 15px;
    color: var(--mp-text-muted);
    max-width: 600px;
    margin: 0 auto;
    font-weight: 500;
}

/* Premium Cards */
.masspost-premium-card {
    background: var(--mp-card-bg);
    border-radius: var(--mp-radius-lg);
    box-shadow: var(--mp-shadow);
    border: 1px solid var(--mp-border);
    margin-bottom: 24px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    grid-column: span 2;
}

.masspost-premium-card:hover {
    box-shadow: var(--mp-shadow-lg);
}

.masspost-premium-card-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--mp-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #f9fafb;
}

.masspost-premium-card-title {
    font-size: 16px;
    /* Reduced title size */
    font-weight: 600;
    color: var(--mp-primary);
    margin: 0;
}

.masspost-premium-card-content {
    padding: 24px;
}

/* Status Pills */
.mp-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.mp-pill-active {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #d1fae5;
}

.mp-pill-inactive {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fee2e2;
}

.mp-pill-pending {
    background: #fffbeb;
    color: #d97706;
    border: 1px solid #fef3c7;
}

/* Form Grid */
.masspost-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.masspost-field-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.masspost-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--mp-text);
}

.masspost-input {
    width: 100%;
    padding: 10px 12px !important;
    background: #ffffff;
    border: 1px solid var(--mp-border) !important;
    border-radius: var(--mp-radius-md) !important;
    font-size: 14px;
    color: var(--mp-text) !important;
    transition: all 0.2s ease;
    font-family: inherit;
}

.masspost-input:focus {
    border-color: var(--mp-accent);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    outline: none;
}

.masspost-code-block {
    background: #f1f5f9;
    padding: 12px;
    border-radius: var(--mp-radius-sm);
    font-family: 'SF Mono', 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    color: #475569;
    border: 1px solid #e2e8f0;
    word-break: break-all;
}

/* Repeater Items */
.masspost-repeater-item {
    background: #ffffff;
    border: 1px solid var(--mp-border);
    border-radius: var(--mp-radius-md);
    padding: 20px;
    margin-bottom: 16px;
    position: relative;
    transition: all 0.2s;
    cursor: move;
}

.masspost-repeater-item:hover {
    border-color: var(--mp-accent);
    box-shadow: var(--mp-shadow);
}

.masspost-repeater-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 10px;
}

/* 10x Modern Buttons */
.masspost-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 40px;
    /* Compact height */
    padding: 0 20px;
    font-weight: 600;
    font-size: 13px;
    border-radius: var(--mp-radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    text-decoration: none;
    gap: 8px;
    white-space: nowrap;
    outline: none;
    font-family: inherit;
}

.mp-btn-primary {
    background: var(--mp-primary);
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.mp-btn-primary:hover {
    background: #000000;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.mp-btn-accent {
    background: var(--mp-accent);
    color: #ffffff;
    box-shadow: 0 1px 2px rgba(99, 102, 241, 0.2);
}

.mp-btn-accent:hover {
    background: var(--mp-accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(99, 102, 241, 0.2);
}

.mp-btn-outline {
    background: transparent;
    border: 1px solid var(--mp-border);
    color: var(--mp-text);
}

.mp-btn-outline:hover {
    border-color: var(--mp-text-muted);
    background: #f9fafb;
}

.mp-btn-remove {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--mp-radius-sm);
    color: var(--mp-text-muted);
    background: transparent;
    border: 1px solid transparent;
}

.mp-btn-remove:hover {
    background: #fef2f2;
    color: var(--mp-danger);
    border-color: #fee2e2;
}

.mp-btn-revoke {
    background: #fef2f2;
    color: #dc2626;
    border: 1px solid #fee2e2;
}

.mp-btn-revoke:hover {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fecaca;
}

#masspost-revoke-btn:focus {
    outline-style: none;
    box-shadow: none;
}

.mp-btn-revoke:active {
    background: #dc2626;
    color: #ffffff;
    border: 1px solid #dc2626;
}

/* Action Bar Layout */
.masspost-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--mp-border);
}

.masspost-action-bar-left {
    display: flex;
    gap: 12px;
    align-items: center;
}

.masspost-action-bar-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

#masspost-save-result {
    margin-top: 16px;
}

#masspost-save-result .notice {
    margin: 0;
}

/* Spinner Animation */
@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.dashicons.spin {
    animation: spin 1s linear infinite;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .masspost-admin-wrap {
        margin: 16px 8px;
        padding-bottom: 32px;
    }

    .masspost-header {
        padding-bottom: 24px;
    }

    .masspost-header img {
        height: 32px;
    }

    .masspost-header h1 {
        font-size: 20px;
        display: none;
    }

    /* Stack grid items */
    .masspost-form-grid,
    .masspost-repeater-fields {
        gap: 16px;
        display: flex;
        flex-wrap: wrap;
    }

    .masspost-field-group {
        flex: 1 1 100%;
        min-width: 0;
    }

    .masspost-input {
        width: 100%;
        min-width: 0;
    }

    /* Span columns on mobile should just be full width */
    .masspost-repeater-fields>div[style*="grid-column: span 2"] {
        flex: 1 1 100%;
    }

    .masspost-premium-card-header {
        padding: 12px 16px;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .masspost-premium-card-content {
        padding: 16px;
    }

    /* Stack buttons in header if needed */
    .masspost-premium-card-header .masspost-btn {
        width: 100%;
    }

    /* Action bar responsive layout */
    .masspost-action-bar {
        flex-wrap: wrap;
    }

    .masspost-action-bar-left {
        flex: 1 1 100%;
        order: 1;
    }

    .masspost-action-bar-left .masspost-btn {
        flex: 1;
    }

    .masspost-action-bar-right {
        flex: 1 1 100%;
        order: 2;
        margin-top: 12px;
    }

    .masspost-action-bar-right .masspost-btn {
        width: 100%;
    }
}

/* Quick Edit - MassPost Target (Matches Categories screenshot exactly) */
.masspost-inline-group {
    clear: both;
    margin-bottom: 15px;
}

.masspost-inline-group .title {
    display: block;
    float: none;
    width: auto;
    padding-bottom: 4px;
    line-height: 2.5;
}

.masspost-sites-scroll {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #dcdcde;
    margin: 0;
    padding: 6px 10px;
    min-width: 250px;
}

.masspost-sites-scroll .masspost-site-row {
    display: block;
    float: none !important;
    padding: 3px 0;
    line-height: 1.4;
    cursor: pointer;
}

.masspost-sites-scroll .masspost-site-row input[type="checkbox"] {
    margin: -1px 4px 0 0;
    vertical-align: middle;
}

.masspost-sites-scroll .masspost-site-row .checkbox-title {
    vertical-align: middle;
    font-size: 13px;
    color: #1f2937;
}