/**
 * Shareable Draft Previews – Admin Styles
 * Version: 1.0.0
 * Text Domain: okto-shareable-draft-previews
 */

 #osdp-metabox {
    font-size: 13px;
    line-height: 1.5;
}

#osdp-metabox .button {
    margin: 8px 0;
    width: 100%;
    text-align: center;
    justify-content: center;
}

/* Make metabox container bigger */
#osdp_links .inside {
    padding: 12px 16px !important;
}

/* Ensure select dropdowns have arrows */
#osdp-new-expiry,
.osdp-edit-expiry,
.osdp-expiry-edit select {
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background-color: #fff !important;
    background-image: url('data:image/svg+xml;charset=UTF-8,%3csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"%3e%3cpolyline points="6 9 12 15 18 9"%3e%3c/polyline%3e%3c/svg%3e') !important;
    background-repeat: no-repeat !important;
    background-position: right 8px center !important;
    background-size: 16px !important;
    padding-right: 32px !important;
}

#osdp-links-list {
    margin-top: 12px;
}

/* Link container - increased padding and min-height for better spacing */
.osdp-link {
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    padding: 16px;
    margin-bottom: 12px;
    position: relative;
    font-size: 12px;
    overflow: visible;
    min-height: 165px;
    box-sizing: border-box;
}

/* Expired link styling */
.osdp-link.osdp-link-expired {
    background: #fef7f7;
    border-color: #d63638;
}

.osdp-link strong {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
    color: #1d2327;
}

/* Unified container for URL and Copy button */
.osdp-url-container {
    display: flex;
    align-items: stretch;
    gap: 6px;
    margin: 4px 0 12px 0;
    border: 1px solid #8c8f94;
    border-radius: 3px;
    overflow: hidden;
    background: #f6f7f7;
}

.osdp-link input[type="text"] {
    flex: 3;
    font-size: 11px;
    padding: 6px 8px;
    font-family: monospace;
    background: #f6f7f7;
    border: none;
    margin: 0;
    outline: none;
}

.osdp-link input[type="text"]:focus {
    background: #fff;
}

.osdp-link .osdp-copy {
    flex: 1;
    margin: 0;
    font-size: 11px;
    padding: 6px 8px;
    height: auto;
    line-height: 1.4;
    white-space: nowrap;
    border: none;
    border-left: 1px solid #8c8f94;
    border-radius: 0;
    background: #f0f0f1;
    cursor: pointer;
    flex-shrink: 0;
}

.osdp-link .osdp-copy:hover {
    background: #dcdcde;
}

.osdp-link .osdp-copy:active {
    background: #c3c4c7;
}

.osdp-url-container:hover {
    border-color: #2271b1;
}

.osdp-url-container:focus-within {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

/* Status and Expiry Row - single line layout */
.osdp-status-expiry-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 10px 0;
    flex-wrap: wrap;
}

.osdp-status-expiry-row .status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    flex-shrink: 0;
}

.osdp-status-expiry-row .status.active {
    background: #00a32a;
    color: #fff;
}

.osdp-link .status.revoked {
    background: #f8d7da;
    color: #58151c;
}

.osdp-status-expiry-row .status.expired {
    background: #d63638;
    color: #fff;
}

.osdp-expiry-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #2c3338;
}

.osdp-expiry-inline strong {
    display: inline;
    font-size: 12px;
    margin: 0;
    font-weight: 600;
}

.osdp-expiry-inline .osdp-expiry-display {
    font-size: 12px;
    color: #646970;
}

/* Expiry Date Row - Shows date on separate line */
.osdp-expiry-date-row {
    margin: 4px 0 10px 0;
}

.osdp-expiry-date-row small.osdp-expiry-date {
    display: block;
    color: #646970;
    font-size: 11px;
    margin: 0;
}

.osdp-link small {
    display: block;
    color: #646970;
    margin: 4px 0;
}

/* OLD expiry info styling - for expired links only */
.osdp-expiry-info {
    display: block;
    margin: 6px 0 !important;
}

.osdp-expiry-info small {
    display: inline;
    margin: 0 !important;
}

/* Expiry date appears on next line */
.osdp-expiry-info small.osdp-expiry-date {
    display: block;
    margin-top: 4px !important;
    color: #646970;
}

/* For expired links, display block with spacing */
.osdp-link.osdp-link-expired .osdp-expiry-info {
    display: block;
    margin: 6px 0 !important;
}

/* Expired text styling - italic, smaller, reduced spacing */
.osdp-link .osdp-expired-text {
    font-style: italic;
    font-size: 11px;
    color: #d63638;
    display: block;
    margin: 0 !important;
}

/* Actions */
.osdp-link .osdp-actions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f0f0f1;
    display: flex;
    gap: 12px;
    font-size: 12px;
}

.osdp-link .osdp-actions a {
    color: #2271b1;
    text-decoration: none;
    margin-right: 0;
}

.osdp-link .osdp-actions a:hover {
    color: #135e96;
    text-decoration: underline;
}

/* Hide actions for expired links */
.osdp-link.osdp-link-expired .osdp-actions {
    display: none;
}

/* Expiry Edit Box - Compact Design */
.osdp-expiry-edit {
    display: none;
    margin: 8px 0 !important;
    padding: 10px !important;
    background: #f6f7f7 !important;
    border: 1px solid #c3c4c7 !important;
    border-radius: 3px !important;
    position: relative;
    z-index: 10;
}

.osdp-expiry-edit label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #1d2327;
}

/* Datetime input styling */
.osdp-expiry-edit .osdp-edit-custom-datetime {
    width: 100%;
    margin-top: 5px !important;
    margin-bottom: 6px;
    font-size: 13px;
    padding: 6px 8px;
    box-sizing: border-box;
    border: 1px solid #8c8f94;
    border-radius: 3px;
    background: #fff;
}

/* Select dropdown styling with arrow */
.osdp-expiry-edit .osdp-edit-expiry {
    width: 100% !important;
    margin-top: 5px !important;
    margin-bottom: 6px !important;
    font-size: 13px !important;
    padding: 6px 8px !important;
    padding-right: 32px !important;
    box-sizing: border-box !important;
    border: 1px solid #8c8f94 !important;
    border-radius: 3px !important;
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    background: #fff url('data:image/svg+xml;charset=UTF-8,%3csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"%3e%3cpolyline points="6 9 12 15 18 9"%3e%3c/polyline%3e%3c/svg%3e') no-repeat right 8px center !important;
    background-size: 16px !important;
}

/* Professional datepicker styling */
.osdp-expiry-edit input[type="datetime-local"],
#osdp-new-custom-datetime {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    cursor: pointer;
    transition: border-color 0.2s ease-in-out;
    color: #2c3338;
}

/* Style placeholder for datetime-local */
#osdp-new-custom-datetime::-webkit-datetime-edit {
    color: #2c3338;
}

#osdp-new-custom-datetime::-webkit-datetime-edit-fields-wrapper {
    color: #2c3338;
}

/* When empty, show placeholder style */
#osdp-new-custom-datetime:not(:focus):invalid {
    color: #646970;
}

.osdp-expiry-edit input[type="datetime-local"]:hover,
#osdp-new-custom-datetime:hover {
    border-color: #2271b1;
}

.osdp-expiry-edit input[type="datetime-local"]:focus,
#osdp-new-custom-datetime:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

/* Datepicker calendar icon styling */
.osdp-expiry-edit input[type="datetime-local"]::-webkit-calendar-picker-indicator,
#osdp-new-custom-datetime::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.7;
    padding: 4px;
    transition: opacity 0.2s ease-in-out;
}

.osdp-expiry-edit input[type="datetime-local"]::-webkit-calendar-picker-indicator:hover,
#osdp-new-custom-datetime::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

.osdp-expiry-edit p {
    margin: 5px 0 0 0 !important;
    display: flex;
    gap: 6px;
}

.osdp-expiry-edit .button-small {
    flex: 1;
    font-size: 12px;
    padding: 4px 10px;
    height: auto;
    line-height: 1.4;
}

/* Expiry Badge */
.osdp-expiry {
    display: inline-block;
    background: #f0f0f1;
    color: #3c434a;
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 3px;
    margin-top: 2px;
}

.osdp-expiry.expired {
    background: #f8d7da;
    color: #d63638;
    font-weight: 600;
}

/* New Link Form styling */
#osdp-new-link-form {
    margin-bottom: 15px;
    padding: 12px;
    background: #f6f7f7;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
}

#osdp-new-link-form label {
    font-size: 12px;
}

#osdp-new-link-form input[type="text"],
#osdp-new-link-form select,
#osdp-new-link-form input[type="datetime-local"] {
    padding: 6px 8px;
    font-size: 13px;
}

/* Admin Notices (Yoast, Cache, etc.) */
.osdp-notice-inline {
    background: #fff3cd;
    border-left: 4px solid #ffba00;
    padding: 8px 12px;
    margin: 10px 0;
    font-size: 12px;
    border-radius: 0 4px 4px 0;
}

.osdp-notice-inline a {
    color: #d63638;
    font-weight: 600;
    text-decoration: underline;
}

/* Posts List Column */
.column-osdp_preview {
    width: 100px;
}

.column-osdp_preview .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.column-osdp_preview .osdp-active {
    color: #27c14f;
}

.column-osdp_preview .osdp-none {
    color: #a7aaad;
}

/* Settings Page */
.osdp-settings-table th {
    width: 200px;
}

.osdp-code-snippet {
    background: #f6f7f7;
    border: 1px solid #c3c4c7;
    padding: 10px;
    font-family: Consolas, Monaco, monospace;
    font-size: 13px;
    overflow-x: auto;
    border-radius: 4px;
    margin: 8px 0;
}

/* RTL Support */
.rtl .osdp-link .osdp-actions a {
    margin-right: 0;
    margin-left: 8px;
}

.rtl .osdp-notice-inline {
    border-left: none;
    border-right: 4px solid #ffba00;
    border-radius: 4px 0 0 4px;
}

.rtl .osdp-link .osdp-copy {
    border-left: none;
    border-right: 1px solid #8c8f94;
}

.rtl .osdp-expiry-info {
    margin: 0 8px 0 0 !important;
}

/* Responsive adjustments for narrow sidebars */
@media (max-width: 782px) {
    .osdp-link input[type="text"] {
        font-size: 12px;
    }

    .column-osdp_preview {
        display: none;
    }
    
    /* Stack vertically on mobile */
    .osdp-url-container {
        flex-direction: column;
    }
    
    .osdp-link .osdp-copy {
        border-left: none;
        border-top: 1px solid #8c8f94;
    }
    
    .osdp-link input[type="text"],
    .osdp-link .osdp-copy {
        flex: 1;
        width: 100%;
    }
    
    /* Stack status-expiry row on mobile */
    .osdp-status-expiry-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }
    
    .osdp-link {
        min-height: 180px;
    }
}

/* Accessibility */
.osdp-link a:focus,
.osdp-link button:focus,
#osdp-new-link:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* Search Bar Styles */
#osdp-links-search:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

#osdp-links-search::placeholder {
    color: #a7aaad;
}