/**
 * Admin Interface Styles
 *
 * Implements styles for the plugin's administrative interface with:
 * - Modular component organization
 * - WordPress admin UI integration
 * - Responsive design patterns
 * - State-based visual feedback
 * - Accessibility enhancements
 *
 * @package Attributes\Assets\CSS
 * @since 1.1.0
 */

/* -----------------------------------------------------------------------------
 * 1. Core Admin Container
 * Establishes the base styling context for the plugin's admin interface.
 * -------------------------------------------------------------------------- */

body[class*="attributes-user-access"] {
    background: #e6e2ef;
}

#wpbody {
    padding: 0 20px;
}

#wpbody-content {
    display: flex;
    flex-wrap: wrap;
    flex-direction: column;
}

#wpbody-content>div {
    order: 1;
}

#wpcontent {
    min-height: calc(100vh - 40px);
}

.attrua {
    font-family: "attr";
    font-style: normal;
    font-weight: normal;
    display: inline-block;
    text-decoration: inherit;
    width: 1em;
    margin-right: .2em;
    text-align: center;
    font-variant: normal;
    text-transform: none;
    line-height: 1em;
    margin-left: .2em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body[class*="attributes-user-access"] {
    background: #e6e2ef;
}

body[class*="attributes-user-access"] #wpcontent {
    padding: 0;
}

body[class*="attributes-user-access"] ul#adminmenu a.wp-has-current-submenu:after,
body[class*="attributes-user-access"] ul#adminmenu>li.current>a.current:after {
    border-right-color: #e6e2ef;
}

/* Updated masthead styles */

.attrua-masthead {
    background: #fff;
    width: calc(100% - -40px);
    height: 100px;
    border-bottom: 1px solid #e2e4e7;
    order: 0 !important;
    margin-left: -20px;
}

.attrua-masthead-container {
    display: flex;
    height: 100px;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.attrua-masthead-logo-container {
    width: 1024px;
    text-align: center;
    font-size: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    font-weight: 600;
}

.attrua-version-number {
    font-size: large;
    color: #999;
}

/* Updated content layout */
body[class*="attributes-user-access"] #wpcontent {
    padding: 0;
}

.attrua-wrapper {
    padding: 20px;
}

.attrua-wrapper .attrua-nav-tabs {
    display: none;
}

.attrua-tab-content {
    position: relative;
    margin: 40px 0 20px;
    background: #fff;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.1);
}

.attrua-tab-content .description {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    margin-bottom: 30px;
}

.attrua-tab-content .description>div {
    flex: 1;
    min-width: 300px;
}

.attrua-tab-content .description h3 {
    margin-top: 0;
    color: #1d2327;
}

/* Footer styles */
.attrua-footerline {
    text-align: center;
    margin: 20px 0;
    color: #646970;
}

.attrua-footerline a {
    color: #2271b1;
    text-decoration: none;
}

.attrua-footerline a:hover {
    color: #135e96;
}

/* -----------------------------------------------------------------------------
 * 2. Settings Sections
 * Defines layout and spacing for major content sections.
 * -------------------------------------------------------------------------- */

.attrua-settings-section {
    margin-top: 20px;
    background: #fff;
    border: 1px solid #c3c4c7;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
    border-radius: 4px;
    overflow: hidden;
}

.attrua-settings-section h2 {
    margin: 0 0 15px;
    padding: 0;
    font-size: 1.4em;
    font-weight: 600;
}

.attrua-section-header {
    padding: 20px 20px 0;
}

.attrua-settings-section .description {
    margin-bottom: 20px;
    color: #646970;
}

/* Table Layout Enhancements */
.attrua-settings-section .form-table {
    margin-top: 0;
}

.attrua-settings-section .form-table th {
    padding: 20px;
    vertical-align: top;
    font-weight: 600;
}

.attrua-settings-section .form-table.attrua-pages-table th {
    vertical-align: middle;
}

.attrua-settings-section .form-table td {
    padding: 20px 10px;
    vertical-align: middle;
}

/* Field Groups */
.attrua-settings-section fieldset {
    margin: 0;
    padding: 0;
    border: none;
}

.attrua-settings-section legend {
    margin: 0 0 10px;
    font-weight: 600;
}

/* Pages Table Styles */
.attrua-pages-table {
    border-collapse: collapse;
    width: 100%;
}

.attrua-pages-table th,
.attrua-pages-table td {
    padding: 15px;
    border-bottom: 1px solid #e2e4e7;
}

/* Page Title Input */
.attrua-page-title {
    width: 100%;
    padding: 8px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
}

/* Page Title Display */
.attrua-page-title-display,
.attrua-page-slug-display {
    font-weight: normal;
}

/* -----------------------------------------------------------------------------
 * 3. Page Management Controls
 * Styles for page creation, editing, and deletion interfaces.
 * -------------------------------------------------------------------------- */

.attrua-page-control {
    position: relative;
}

.attrua-page-row code {
    font-family: monospace;
    color: #666;
    padding: 8px;
    background: #f0f0f1;
    border-radius: 4px;
    width: fit-content;
}

/* Shortcode Display */
.attrua-page-shortcode {
    display: flex;
    align-items: center;
    gap: 8px;
}

.attrua-copy-shortcode {
    padding: 2px 8px;
    background: #fff;
    border-radius: 3px;
    cursor: pointer;
    font-size: 20px;
    border: none;
    color: #2196F3;
}

.attrua-copy-shortcode:hover {
    background: #f6f7f7;
}

.attrua-page-prefix {
    padding: 8px 3px;
}

/* Action Buttons Container */
.attrua-page-actions {
    display: flex;
    gap: 8px;
}

.attrua-page-actions .button {
    display: inline-flex;
    align-items: center;
    min-width: 80px;
    justify-content: center;
}

.attrua-page-actions .attrua-delete {
    border-color: #d63638;
    color: #d63638;
}

.attrua-page-actions .attrua-delete:hover {
    border-color: #a12224;
    color: #a12224;
}

/* Loading States */
.attrua-page-actions .button:disabled {
    opacity: 0.7;
    cursor: wait;
}

/* Redirect Toggle */
.attrua-redirect-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.attrua-redirect-url {
    margin-top: 4px;
    display: block;
    color: #666;
    font-family: monospace;
    word-break: break-all;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 4px 8px;
    border-radius: 4px;
    width: 100%;
}

/* Slider styles */
.attrua-redirect-toggle .slider {
    position: relative;
    display: inline-block;
    width: 100px;
    max-width: 40px;
    height: 24px;
    background-color: #ccc;
    border-radius: 12px;
    transition: .4s;
    cursor: pointer;
}

.attrua-redirect-toggle .slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

.attrua-redirect-toggle input:checked+.slider {
    background-color: #2196F3;
}

.attrua-redirect-toggle input:checked+.slider:before {
    transform: translateX(16px);
}

.attrua-redirect-toggle input {
    opacity: 0;
}

input:disabled+.slider {
    background-color: #e0e0e0;
    cursor: not-allowed;
}

/* -----------------------------------------------------------------------------
 * 4. Form Elements
 * Custom styling for form inputs and controls.
 * -------------------------------------------------------------------------- */

/* Text Inputs */
.attrua-settings-section input[type="text"] {
    font-weight: normal;
    background: #f8fcff;
    border-color: #b9c6d3;
}

/* -----------------------------------------------------------------------------
 * 7. Responsive Adaptations
 * Layout adjustments for different screen sizes.
 * -------------------------------------------------------------------------- */

@media screen and (max-width: 782px) {
    .attrua-settings-section .form-table th {
        padding-bottom: 10px;
    }

    .attrua-settings-section .form-table td {
        padding-left: 0;
    }

    .attrua-page-actions {
        flex-direction: column;
    }

    .attrua-page-actions .button {
        width: 100%;
        margin-bottom: 8px;
    }
}

/* -----------------------------------------------------------------------------
 * 8. State-Based Styles
 * Visual feedback for different interaction states.
 * -------------------------------------------------------------------------- */

/* Input field error styling */
.attrua-field-error {
    border-color: #d63638 !important;
    box-shadow: 0 0 0 1px #d63638 !important;
    outline: 2px solid transparent;
}

/* Error message animation */
.attrua-notification.error,
.attrua-error {
    border-left: 4px solid #d63638;
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* Notification Container */
.attrua-notifications-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 300px;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
}

/* Individual Notification */
.attrua-notification {
    color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    display: flex;
    align-items: start;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.attrua-notification.show {
    opacity: 1;
    transform: translateX(0);
}

/* Notification Types */
.attrua-notification.success {
    background: #00a3297e;
}

.attrua-notification.error {
    background: #d636397c;
}

.attrua-notification.warning {
    background: #ffb900;
}

.attrua-notification.info {
    background: #00a0d2;
}

/* Notification Content */
.attrua-notification-content {
    padding: 12px 40px 12px 12px;
    position: relative;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    line-height: 1.4;
}

/* Dismiss Button */
.attrua-notification-dismiss {
    position: absolute;
    top: 11.5px;
    right: 8px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 4px;
    color: #fff;
    border-radius: 50%;
    line-height: 1;
}

.attrua-notification-dismiss:hover {
    color: #1e1e1e;
    background: #f0f0f0;
}

/* Animation for removal */
.attrua-notification.hide {
    opacity: 0;
    transform: translateX(100%);
}

/* Icons within notifications */
.attrua-notification .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

/* Responsive adjustments */
@media screen and (max-width: 782px) {
    .attrua-notifications-container {
        top: 46px;
        /* WP Admin bar is taller on mobile */
        right: 10px;
    }
}

/* When admin bar is hidden */
body:not(.admin-bar) .attrua-notifications-container {
    top: 10px;
}

/* -----------------------------------------------------------------------------
 * 9. Premium Features
 * Styles for premium feature promotion and integration.
 * -------------------------------------------------------------------------- */

.attrua-premium-feature {
    position: relative;
    padding-right: 100px;
}

.attrua-premium-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 4px 8px;
    background: #2271b1;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    border-radius: 3px;
}

/* -----------------------------------------------------------------------------
 * 10. Accessibility Enhancements
 * Improves interface usability for all users.
 * -------------------------------------------------------------------------- */

/* Focus States */
.attrua-settings-section a:focus,
.attrua-settings-section button:focus,
.attrua-settings-section input:focus {
    box-shadow: 0 0 0 1px #2271b1, 0 0 2px 1px rgba(34, 113, 177, 0.8);
    outline: 1px solid transparent;
}

/* Screen Reader Text */
.screen-reader-text:not(:focus) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}