/* MD Click Copyboard - Global Styles */

:root {
    --mdcc-accent: #6400f0;
    --mdcc-accent-rgb: 100, 0, 240;
    --mdcc-accent-hover: #5a00db;
    --mdcc-accent-hover-rgb: 90, 0, 219;
    /* Frontend state colors */
    --mdcc-press-bg: #28a745;
    --mdcc-press-fg: #ffffff;
    --mdcc-success-bg: #28a745;
    --mdcc-success-fg: #ffffff;
    --mdcc-error-bg: #dc3545;
    --mdcc-error-fg: #ffffff;
}

.mdcc_wrapper {
    margin: 10px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Label Styles */
.mdcc_copy-label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.mdcc_copy-label-above {
    margin-bottom: 8px;
}

/* Input Container */
.mdcc_copy-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mdcc_copy-input-container.inside-button {
    position: relative;
}

.mdcc_copy-input-container.outside-button {
    align-items: stretch;
}

/* Input Field (Textarea) */
.mdcc_copy-input {
    flex: 1;
    padding: 14px 20px 14px 20px !important; /* Top, Right, Bottom, Left padding */
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 18px;
    line-height: 1.4;
    background-color: #fff;
    color: #1a1a1a;
    font-weight: 500;
    box-sizing: border-box;
    transition: border-color 0.2s ease;
    max-width: 100%;
    resize: none;
    overflow-y: auto;
    word-wrap: break-word;
    white-space: pre-wrap;
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', 'SF Mono', monospace;
    /* Ensure proper textarea behavior */
    display: block !important;
    width: 100%;
    /* Remove min-height to allow JavaScript to control height */
    min-height: 0;
}

/* First-paint height using CSS variable provided inline by PHP */
.mdcc_copy-input {
    height: var(--mdcc-h, auto);
}

.mdcc_copy-input:focus {
    outline: none;
    border-color: var(--mdcc-accent);
    box-shadow: 0 0 0 1px rgba(var(--mdcc-accent-rgb), 0.2);
}

.mdcc_copy-input.label_inside-style {
    padding-left: 12px;
}

/* Compact styling for single-line textareas (class-based) */
.mdcc_copy-input.mdcc_single-line {
    padding: 14px 20px 14px 20px; /* Top, Right, Bottom, Left */
    line-height: 0.7; /* Center text vertically for single lines */
}

/* Inside-button single-line needs extra right padding */
.mdcc_copy-input-container.inside-button .mdcc_copy-input.mdcc_single-line {
    padding: 14px 50px 14px 20px; /* Top, Right (for button), Bottom, Left */
}

/* External button single-line should match internal button height */
.mdcc_copy-input-container.outside-button .mdcc_copy-input.mdcc_single-line {
    min-height: 46px !important; /* Match the minimum height of internal button input boxes */
    height: 46px !important; /* Override CSS variables to ensure consistent height */
}

/* Button Styles */
.mdcc_copy-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid #ddd;
    background-color: #f8f9fa;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    font-weight: 500;
    border-radius: 4px;
    min-height: 40px;
    box-sizing: border-box;
}

.mdcc_copy-button:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.mdcc_copy-button:active { transform: translateY(1px); }

.mdcc_copy-button:focus {
    outline: none;
    border-color: var(--mdcc-accent);
    box-shadow: 0 0 0 1px rgba(0, 115, 170, 0.2);
}

/* Button Location Styles */
.mdcc_copy-input-container.inside-button .mdcc_copy-button {
    position: absolute;
    right: 5px;
    top: 5px;
    transform: none;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 8px;
    min-height: auto;
    height: auto;
    z-index: 10;
}

/* Ensure inside buttons get the same hover feedback as outside buttons */
.mdcc_copy-input-container.inside-button .mdcc_copy-button:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

/* Ensure pressing wins over inside-button hover */
.mdcc_copy-input-container.inside-button .mdcc_copy-button[data-state="pressing"],
.mdcc_copy-input-container.inside-button .mdcc_copy-button[data-state="pressing"]:hover {
    background-color: var(--mdcc-press-bg);
    border-color: var(--mdcc-press-bg);
    color: var(--mdcc-press-fg);
    transform: translateY(1px);
}

/* Active state is unified via the base rule .mdcc_copy-button:active so copied/error styles win */

.mdcc_copy-input-container.inside-button .mdcc_copy-input {
    padding-right: 50px;
}

.mdcc_copy-input-container.outside-button .mdcc_copy-button {
    min-width: 80px;
    padding: 10px;
    /* Ensure button height matches textarea height exactly */
    height: 46px; /* Match the minimum height of internal button input boxes */
    min-height: 46px;
}

/* Button Style Variations */
.mdcc_copy-button.logo_only-style {
    min-width: 40px;
    padding: 10px;
}

.mdcc_copy-button.text_only-style {
    min-width: 80px;
}

.mdcc_copy-button.logo_and_text-style {
    min-width: 100px;
    padding: 10px;
}

/* Icon Styles */
.mdcc_copy-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* Text Styles */
.mdcc_copy-text {
    white-space: nowrap;
}

/* Success State */
.mdcc_copy-button.copied {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
}

.mdcc_copy-button.copied:hover {
    background-color: #28a745;
    border-color: #28a745;
}

/* Ensure inside-button respects success/error states (higher specificity than base inside rule) */
.mdcc_copy-input-container.inside-button .mdcc_copy-button.copied {
    background-color: #28a745;
    border-color: #28a745;
    color: #fff;
}
.mdcc_copy-input-container.inside-button .mdcc_copy-button.copied:hover {
    background-color: #28a745;
    border-color: #28a745;
}
.mdcc_copy-input-container.inside-button .mdcc_copy-button.error {
    background-color: #dc3545;
    border-color: #dc3545;
    color: #fff;
}

/* Frontend state-driven visuals (scoped to rendered elements) */
.mdcc_wrapper .mdcc_copy-button[data-state="pressing"] {
    background-color: var(--mdcc-press-bg);
    border-color: var(--mdcc-press-bg);
    color: var(--mdcc-press-fg);
    transform: translateY(1px);
}
.mdcc_wrapper .mdcc_copy-button[data-state="copied"] {
    background-color: var(--mdcc-success-bg);
    border-color: var(--mdcc-success-bg);
    color: var(--mdcc-success-fg);
}
.mdcc_wrapper .mdcc_copy-button[data-state="error"] {
    background-color: var(--mdcc-error-bg);
    border-color: var(--mdcc-error-bg);
    color: var(--mdcc-error-fg);
}

/* Responsive Design - Removed mobile-specific rules, using unified approach */

/* Accessibility */
.mdcc_copy-button:focus-visible {
    outline: 2px solid var(--mdcc-accent);
    outline-offset: 2px;
}

.mdcc_copy-input:focus-visible {
    outline: 2px solid var(--mdcc-accent);
    outline-offset: 2px;
}

/* ========================================
   ADMIN STYLES
   ======================================== */

/* Meta box styling */
#copy_element_settings .mdcc-row-copy-shortcode td {
    display: flex;
    align-items: center;
    gap: 0px;
}

#copy_element_settings .form-table th {
    width: 150px;
    padding: 15px 10px 15px 0;
}

#copy_element_settings .form-table td {
    padding: 15px 10px;
}

#copy_element_settings select,
#copy_element_settings input[type="text"] {
    width: 100%;
    max-width: 400px;
}

#copy_element_settings textarea {
    width: 100%;
    max-width: 600px;
    min-height: 120px;
}

/* Description text */
#copy_element_settings .mdcc_shortcode_description {
    color: #666;
    font-style: italic;
    margin-top: 0px;
}

/* Preview section */
.copy-element-preview {
    margin-top: 20px;
    padding: 20px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.copy-element-preview h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

/* Admin List Table Column Styles */
.wp-list-table .column-id {
    width: 60px;
    text-align: center;
}

.wp-list-table .column-shortcode {
    width: 200px;
}

.wp-list-table .column-copy_shortcode {
    width: 180px;
    text-align: center;
}

/* Consistent horizontal padding for all columns on the Copy Elements list */
.post-type-copy_element .wp-list-table th,
.post-type-copy_element .wp-list-table td {
    padding-right: 14px;
}

/* New Element Action Button Styles */
.mdcc_action-btn {
    background: var(--mdcc-accent);
    border: none;
    color: #fff;
    transition: all 0.2s ease;
    box-shadow: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    min-height: 40px;
    border-radius: 6px;
    font-weight: 600;
}

.mdcc_action-btn:hover {
    background: var(--mdcc-accent-hover);
    color: #fff;
    text-decoration: none;
}

.mdcc_action-btn:focus {
    background: var(--mdcc-accent-hover);
    color: #fff;
    box-shadow: 0 0 0 1px #fff, 0 0 0 3px var(--mdcc-accent);
    outline: none;
}

/* Override WordPress default page-title-action for copy_element post type */
.post-type-copy_element .page-title-action {
    background: var(--mdcc-accent) !important;
    border: none !important;
    color: #fff !important;
    transition: all 0.2s ease !important;
    box-shadow: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 4px 12px !important;
    min-height: 32px !important;
    border-radius: 3px !important;
    font-weight: 600 !important;
}

/* Add plus icon to New Element button */
.post-type-copy_element .page-title-action::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none'%3E%3Cpath d='M12 5V19M5 12H19' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    flex-shrink: 0;
}

.post-type-copy_element .page-title-action:hover {
    background: var(--mdcc-accent-hover) !important;
    color: #fff !important;
    text-decoration: none !important;
}

.post-type-copy_element .page-title-action:focus {
    background: var(--mdcc-accent-hover) !important;
    color: #fff !important;
    box-shadow: 0 0 0 1px #fff, 0 0 0 3px var(--mdcc-accent) !important;
    outline: none !important;
}

/* Copy Shortcode Button Styles */
.mdcc_copy-shortcode-btn {
    background: none !important;
    border: 1px solid var(--mdcc-accent) !important;
    color: var(--mdcc-accent) !important;
    box-shadow: none !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 8px !important;
    padding: 10px 16px !important;
    min-height: 40px !important;
    border-radius: 6px !important;
    font-weight: 600 !important;
    box-shadow: none !important;
}

.mdcc_copy-shortcode-btn:hover {
    background: var(--mdcc-accent-hover) !important;
    border: 1px solid var(--mdcc-accent-hover) !important;
    color: #fff !important;
    box-shadow: none !important;
}

.mdcc_copy-shortcode-btn:active,
.mdcc_copy-shortcode-btn:focus,
.mdcc_copy-shortcode-btn:focus-visible {
    border: 1px solid var(--mdcc-accent) !important;
    box-shadow: none !important;
}

.mdcc_copy-shortcode-btn.copied {
    background: #28a745 !important;
    border-color: #28a745 !important;
    color: white !important;
}

.mdcc_copy-shortcode-btn.error {
    background: #dc3545 !important;
    border-color: #dc3545 !important;
    color: white !important;
}

/* Shortcode display styling */
.wp-list-table .column-shortcode code {
    font-family: 'Courier New', monospace;
    font-size: 11px;
    word-break: break-all;
}

/* Responsive admin - Removed mobile-specific rules, using unified approach */

/* Disabled field styling */
#copy_element_settings input:disabled,
#copy_element_settings select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Future customization fields (for paid version) */
.mdcc-customization-section {
    margin-top: 20px;
    padding: 15px;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.mdcc-customization-section h4 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.mdcc-customization-section .mdcc_shortcode_description {
    color: #666;
    font-style: italic;
    font-size: 12px;
} 

/* Hide textarea until JS applies the correct height to prevent flash */
.mdcc_copy-input.mdcc_pending {
    visibility: hidden;
} 