/**
 * MDS Enhanced Page Creator Styles
 * Modern, user-friendly interface for creating MDS pages
 */

/* Container and Layout */
.mds-create-pages {
    max-width: 1200px;
    color: #1d2327;
    font-weight: normal;
}

.mds-create-pages * {
    font-weight: inherit;
}

.mds-page-creator-container {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    margin-top: 20px;
}

.mds-creator-form {
    padding: 20px;
}

/* Steps */
.mds-creator-step {
    margin-bottom: 40px;
    padding: 20px;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    background: #fafafa;
    transition: background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, border-style 0.3s ease;
}

.mds-creator-step.active {
    background: #fff;
    border-color: #0073aa;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.1);
}

.mds-creator-step.inactive {
    background: #f5f5f5;
    border-style: dashed;
    border-color: #ccc;
}

.mds-creator-step h2 {
    margin-top: 0;
    color: #23282d;
    font-size: 1.3em;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

.mds-creator-step .description {
    color: #646970;
    font-style: italic;
    margin-bottom: 20px;
}

/* Implementation Types */
.mds-implementation-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.mds-implementation-option {
    position: relative;
}

.mds-radio-card {
    display: block;
    cursor: pointer;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 0;
    background: #fff;
    transition: all 0.3s ease;
    height: 100%;
}

.mds-radio-card:hover {
    border-color: #0073aa;
    box-shadow: 0 2px 8px rgba(0, 115, 170, 0.15);
}

.mds-radio-card input[type="radio"] {
    position: absolute;
    top: 15px;
    right: 15px;
    margin: 0;
}

.mds-radio-card input[type="radio"]:checked + .mds-card-content {
    background: #f0f8ff;
    border-radius: 6px;
}

.mds-implementation-option.selected .mds-radio-card {
    border-color: #0073aa;
    background: #f0f8ff;
}

.mds-card-content {
    padding: 20px;
    padding-right: 50px; /* Space for radio button */
    border-radius: 6px;
}

.mds-card-content h3 {
    margin: 0 0 10px 0;
    color: #0073aa;
    font-size: 1.1em;
}

.mds-card-content p {
    margin: 0 0 15px 0;
    color: #646970;
}

.mds-pros-cons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 15px;
}

.mds-pros, .mds-cons {
    font-size: 0.9em;
}

.mds-pros strong {
    color: #46b450;
}

.mds-cons strong {
    color: #dc3232;
}

.mds-pros ul, .mds-cons ul {
    margin: 5px 0 0 0;
    padding-left: 20px;
}

.mds-pros li, .mds-cons li {
    margin-bottom: 3px;
    color: #646970;
}

/* Grid Selection */
.mds-grid-selection {
    background: #f9f9f9;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 30px;
}

.mds-grid-selection h3 {
    margin: 0 0 10px 0;
    color: #0073aa;
    font-size: 1.1em;
}

.mds-grid-selection .description {
    color: #646970;
    font-style: italic;
    margin-bottom: 15px;
}

.mds-grid-selector-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.mds-grid-selection select {
    flex: 1;
    min-width: 300px;
    max-width: 400px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.mds-grid-sort-controls {
    display: flex;
    align-items: center;
    gap: 5px;
}

.mds-grid-sort-controls .button {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 10px;
    font-size: 12px;
    line-height: 1;
    border: 1px solid #ddd;
    background: #f7f7f7;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 60px;
    justify-content: center;
}

.mds-grid-sort-controls .button:hover {
    background: #e7e7e7;
    border-color: #0073aa;
}

.mds-grid-sort-controls .button.active {
    background: #0073aa;
    border-color: #0073aa;
    color: #fff;
}

.mds-grid-sort-controls .dashicons {
    font-size: 14px;
    width: 14px;
    height: 14px;
}

.mds-grid-sort-controls .sort-label,
.mds-grid-sort-controls .sort-direction-label {
    font-weight: 500;
    text-transform: uppercase;
    font-size: 11px;
}

#mds-grid-sort-type-btn {
    background: #e3f2fd;
    border-color: #2196f3;
}

#mds-grid-sort-direction-btn {
    background: #f3e5f5;
    border-color: #9c27b0;
}

#mds-grid-sort-type-btn:hover {
    background: #bbdefb;
    border-color: #1976d2;
}

#mds-grid-sort-direction-btn:hover {
    background: #e1bee7;
    border-color: #7b1fa2;
}

#mds-grid-sort-type-btn.active {
    background: #2196f3;
    border-color: #2196f3;
    color: #fff;
}

#mds-grid-sort-direction-btn.active {
    background: #9c27b0;
    border-color: #9c27b0;
    color: #fff;
}

/* Page Types */
.mds-page-types {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.mds-page-type-option {
    position: relative;
}

.mds-checkbox-card {
    display: block;
    cursor: pointer;
    border: 2px solid #ddd;
    border-radius: 6px;
    padding: 0;
    background: #fff;
    transition: all 0.3s ease;
    height: 100%;
}

.mds-checkbox-card:hover {
    border-color: #0073aa;
    box-shadow: 0 1px 4px rgba(0, 115, 170, 0.15);
}

.mds-checkbox-card input[type="checkbox"] {
    position: absolute;
    top: 15px;
    right: 15px;
    margin: 0;
}

.mds-checkbox-card input[type="checkbox"]:checked + .mds-card-content {
    background: #f0f8ff;
    border-color: #0073aa;
}

.mds-checkbox-card input[type="checkbox"]:disabled {
    opacity: 0.6;
}

.mds-checkbox-card input[type="checkbox"]:disabled + .mds-card-content {
    background: #f9f9f9;
    opacity: 0.8;
}

.mds-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.mds-card-header .dashicons {
    color: #0073aa;
    font-size: 20px;
}

.mds-card-header h3 {
    margin: 0;
    flex: 1;
    color: #23282d;
    font-size: 1em;
}

.mds-required-badge {
    background: #dc3232;
    color: #fff;
    padding: 2px 8px;
    border-radius: 3px;
    font-size: 0.8em;
    font-weight: bold;
}

/* Create Mode Options (Handle Existing Pages) - match implementation types exactly */
.mds-create-mode-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.mds-create-mode-option {
    position: relative;
}

.mds-create-mode-option.selected .mds-radio-card {
    border-color: #0073aa;
    background: #f0f8ff;
}

/* Ensure radio cards maintain solid backgrounds regardless of step state */
.mds-creator-step .mds-radio-card {
    background: #fff;
    opacity: 1;
}

.mds-creator-step .mds-create-mode-option.selected .mds-radio-card,
.mds-creator-step .mds-implementation-option.selected .mds-radio-card {
    background: #f0f8ff;
    opacity: 1;
}

/* Page Configurations */
#mds-page-configurations {
    margin-top: 20px;
    min-height: 100px;
    transition: opacity 0.3s ease;
}

.mds-page-config {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    padding: 20px;
    margin-bottom: 20px;
}

.mds-page-config h4 {
    margin: 0 0 15px 0;
    color: #0073aa;
    border-bottom: 1px solid #e1e1e1;
    padding-bottom: 8px;
}

.mds-page-config .form-table {
    margin-top: 0;
}

.mds-page-config .form-table th {
    width: 200px;
    padding: 15px 10px 15px 0;
}

.mds-page-config .form-table td {
    padding: 15px 0;
}

.mds-page-config fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

.mds-page-config fieldset label {
    display: block;
    margin-bottom: 8px;
    font-weight: normal;
}

.mds-page-config fieldset input[type="checkbox"] {
    margin-right: 8px;
}

/* Loading States */
.mds-loading {
    text-align: center;
    padding: 40px;
    color: #646970;
    font-style: italic;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fafafa;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
}

.mds-loading::before {
    content: "";
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top-color: #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
    vertical-align: middle;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes blink {
    0%, 100% {
        background-color: #0073aa;
        border-color: #0073aa;
        box-shadow: 0 2px 4px rgba(0, 115, 170, 0.2);
        color: #ffffff;
    }
    50% {
        background-color: #2196f3;
        border-color: #2196f3;
        box-shadow: 0 2px 8px rgba(33, 150, 243, 0.4);
        color: #ffffff;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    }
}

/* Actions */
.mds-creator-actions {
    background: #f9f9f9;
    border-top: 1px solid #e1e1e1;
    padding: 20px;
    margin: 20px -20px -20px -20px;
    text-align: right;
}

.mds-creator-actions .button {
    margin-left: 10px;
}

.mds-creator-actions .button-primary {
    background: #0073aa;
    border-color: #0073aa;
}

.mds-creator-actions .button-primary:hover {
    background: #005a87;
    border-color: #005a87;
}

.mds-creator-actions .button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.mds-creator-actions .button.blinking {
    animation: blink 2.5s ease-in-out infinite;
}

/* Respect user's motion preferences */
@media (prefers-reduced-motion: reduce) {
    .mds-creator-actions .button.blinking {
        animation: none;
        background-color: #1976d2 !important;
        border-color: #1976d2 !important;
        box-shadow: 0 2px 6px rgba(25, 118, 210, 0.3) !important;
        color: #ffffff !important;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
    }
}

/* Preview Panel */
.mds-preview-panel, .mds-results-panel {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    margin-top: 20px;
    padding: 20px;
}

.mds-preview-panel h3, .mds-results-panel h3 {
    margin-top: 0;
    color: #0073aa;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

.mds-preview-summary, .mds-results-summary {
    background: #f0f8ff;
    border: 1px solid #0073aa;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
}

.mds-preview-summary p, .mds-results-summary p {
    margin: 5px 0;
}

.mds-preview-warnings {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
}

.mds-preview-warnings h4 {
    color: #856404;
    margin-top: 0;
}

.mds-preview-warnings ul {
    margin-bottom: 0;
    color: #856404;
}

.mds-preview-recommendations {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 20px;
}

.mds-preview-recommendations h4 {
    color: #0c5460;
    margin-top: 0;
}

.mds-preview-recommendations ul {
    margin-bottom: 0;
    color: #0c5460;
}

.mds-preview-pages {
    margin-top: 20px;
}

.mds-preview-pages h4 {
    margin-bottom: 10px;
    color: #23282d;
}

.mds-preview-pages table {
    margin-top: 10px;
}

.mds-preview-actions {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e1e1e1;
    text-align: center;
}

/* Results Sections */
.mds-results-created {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
}

.mds-results-created h4 {
    color: #155724;
    margin-top: 0;
}

.mds-results-updated {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
}

.mds-results-updated h4 {
    color: #0c5460;
    margin-top: 0;
}

.mds-results-errors {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    border-radius: 4px;
    padding: 15px;
    margin-bottom: 15px;
}

.mds-results-errors h4 {
    color: #721c24;
    margin-top: 0;
}

.mds-results-errors li.error {
    color: #721c24;
}

/* Quick Create Widget */
.mds-quick-create {
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 20px;
    margin: 20px 0;
}

.mds-quick-create h3 {
    margin-top: 0;
    color: #0073aa;
}

.mds-quick-create p {
    color: #646970;
    margin-bottom: 15px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mds-implementation-types {
        grid-template-columns: 1fr;
    }
    
    .mds-page-types {
        grid-template-columns: 1fr;
    }
    
    .mds-create-mode-options {
        grid-template-columns: 1fr;
    }
    
    .mds-grid-selector-container {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .mds-grid-selection select {
        min-width: auto;
        width: 100%;
    }
    
    .mds-pros-cons {
        grid-template-columns: 1fr;
    }
    
    .mds-creator-actions {
        text-align: center;
    }
    
    .mds-creator-actions .button {
        display: block;
        width: 100%;
        margin: 5px 0;
    }
    
    .mds-page-config .form-table th {
        width: auto;
        display: block;
        padding-bottom: 5px;
    }
    
    .mds-page-config .form-table td {
        display: block;
        padding-top: 0;
    }
}

/* Accessibility */
.mds-radio-card:focus-within,
.mds-checkbox-card:focus-within {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.mds-radio-card input[type="radio"]:focus,
.mds-checkbox-card input[type="checkbox"]:focus {
    outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mds-creator-step.active {
        border-width: 3px;
    }
    
    .mds-radio-card:hover,
    .mds-checkbox-card:hover {
        border-width: 3px;
    }
    
    .mds-required-badge {
        border: 2px solid #000;
    }
}

/* Print styles */
@media print {
    .mds-creator-actions {
        display: none;
    }
    
    .mds-preview-panel,
    .mds-results-panel {
        border: 2px solid #000;
    }
}

/* Modal Notification System - Consistent with Page Management */
.mds-modal, .mds-notification-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
    display: none;
    backdrop-filter: blur(2px);
}

.mds-modal.show, .mds-notification-modal.show {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.mds-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
}

.mds-modal-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    animation: mdsModalSlideIn 0.3s ease-out;
    will-change: transform, opacity;
    font-weight: normal;
    color: #1d2327;
}

@keyframes mdsModalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.mds-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 0 20px;
    border-bottom: 1px solid #ddd;
}

.mds-modal-header h4, .mds-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #23282d;
    line-height: 1.4;
}

.mds-modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    color: #646970;
    transition: all 0.2s ease;
}

.mds-modal-close:hover {
    background: #f0f0f0;
    color: #000;
}

.mds-modal-close .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

.mds-modal-body {
    display: flex;
    align-items: flex-start;
    padding: 20px;
    gap: 15px;
    color: #1d2327;
    font-weight: normal;
    line-height: 1.5;
}

.mds-modal-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
}

.mds-modal-icon.error {
    background: #dc3232;
}

.mds-modal-icon.success {
    background: #46b450;
}

.mds-modal-icon.warning {
    background: #ffb900;
    color: #000;
}

.mds-modal-icon.info {
    background: #0073aa;
}

.mds-modal-icon::before {
    content: attr(data-icon);
}

.mds-modal-message, .mds-notification-content {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
    color: #1d2327;
    font-weight: normal;
}

.mds-modal-message p, .mds-notification-content p {
    margin: 0 0 1em 0;
    color: #1d2327;
    font-weight: normal;
}

.mds-modal-footer {
    padding: 0 20px 20px 20px;
    text-align: right;
    border-top: 1px solid #ddd;
    padding-top: 15px;
}

.mds-modal-footer .button {
    min-width: 80px;
}

/* Responsive modal */
@media (max-width: 600px) {
    .mds-modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .mds-modal-header,
    .mds-modal-body,
    .mds-modal-footer {
        padding: 15px;
    }
    
    .mds-modal-body {
        flex-direction: column;
        text-align: center;
    }
    
    .mds-modal-icon {
        align-self: center;
    }
}

/* Enhanced Preview Table Styles */
.mds-existing-page-info {
    font-size: 12px;
    line-height: 1.4;
}

.mds-existing-page-info > div {
    margin-bottom: 3px;
}

.mds-existing-page-info > div:last-child {
    margin-bottom: 0;
}

.mds-page-links {
    margin-top: 8px;
    padding-top: 5px;
    border-top: 1px solid #ddd;
}

.mds-page-links .button {
    font-size: 11px;
    height: auto;
    padding: 3px 8px;
    margin-right: 5px;
}

.mds-preview-pages table {
    margin-top: 15px;
}

.mds-preview-pages th:last-child,
.mds-preview-pages td:last-child {
    width: 250px;
    min-width: 250px;
}

.mds-preview-pages td {
    vertical-align: top;
} 