/**
 * LiveLang Admin Modern UI
 * A premium, clean, and user-centric design for the LiveLang Dashboard.
 */

:root {
    --livelang-primary: #2563eb;
    --livelang-primary-hover: #1d4ed8;
    --livelang-primary-light: #eff6ff;
    --livelang-success: #10b981;
    --livelang-warning: #f59e0b;
    --livelang-danger: #ef4444;
    --livelang-text-main: #1e293b;
    --livelang-text-muted: #64748b;
    --livelang-bg-app: #f8fafc;
    --livelang-bg-card: #ffffff;
    --livelang-border: #e2e8f0;
    --livelang-radius: 12px;
    --livelang-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.05), 0 2px 4px -2px rgb(0 0 0 / 0.05);
}

#adminmenu li#toplevel_page_livelang .wp-menu-image img,
#adminmenu .toplevel_page_livelang .wp-menu-image img,
#toplevel_page_livelang .wp-menu-image img {
    width: 16px !important;
    max-width: 16px !important;
    height: 16px !important;
    object-fit: contain !important;
    padding: 0 !important;
    margin-top: 2px !important;
    opacity: 1 !important;
}

#adminmenu li#toplevel_page_livelang .wp-menu-image {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.livelang-admin-dashboard {
    width: 100%;
    max-width: 100%;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--livelang-text-main);
    box-sizing: border-box;
    padding-right: 20px;
}

/* Header Section */
.livelang-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 0 10px;
}

.livelang-header h1 {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    color: var(--livelang-text-main);
}

.livelang-header-badge {
    background: var(--livelang-primary-light);
    color: var(--livelang-primary);
    padding: 4px 12px;
    border-radius: 99px;
    font-size: 13px;
    font-weight: 600;
    margin-left: 12px;
}

/* Main Content Layout */
.livelang-main-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
    align-items: start;
}

/* Sidebar Navigation */
.livelang-sidebar {
    background: var(--livelang-bg-card);
    border-radius: var(--livelang-radius);
    padding: 12px;
    border: 1px solid var(--livelang-border);
    box-shadow: var(--livelang-shadow);
}

.livelang-nav-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 4px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--livelang-text-muted);
    font-weight: 500;
    transition: all 0.2s;
    cursor: pointer;
}

.livelang-nav-item:hover {
    background: #f1f5f9;
    color: var(--livelang-text-main);
}

.livelang-nav-item.is-active {
    background: var(--livelang-primary) !important;
    color: #fff !important;
}

.livelang-nav-item.is-active .dashicons {
    color: #fff !important;
}

.livelang-nav-item i {
    margin-right: 12px;
    font-size: 18px;
}

/* Content Area */
.livelang-content {
    min-width: 0;
}

.livelang-tab-panel {
    display: none;
}

.livelang-tab-panel.is-active {
    display: block;
    animation: livelangFadeIn 0.3s ease-out;
}

@keyframes livelangFadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.livelang-pagination .page-numbers {
    display: inline-block;
    padding: 8px 14px;
    margin: 0 4px;
    background: #fff;
    border: 1px solid var(--livelang-border);
    border-radius: 6px;
    text-decoration: none;
    color: var(--livelang-text-muted);
    transition: all 0.2s;
    font-weight: 500;
}

.livelang-pagination .page-numbers:hover {
    border-color: var(--livelang-primary);
    color: var(--livelang-primary);
}

.livelang-pagination .page-numbers.current {
    background: var(--livelang-primary);
    color: #fff;
    border-color: var(--livelang-primary);
}

.livelang-card {
    background: var(--livelang-bg-card);
    border-radius: var(--livelang-radius);
    border: 1px solid var(--livelang-border);
    box-shadow: var(--livelang-shadow);
    margin-bottom: 24px;
    overflow: hidden;
}

.livelang-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--livelang-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.livelang-card-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.livelang-card-body {
    padding: 24px;
}

/* Form Styles */
.livelang-settings-table {
    width: 100%;
    border-collapse: collapse;
}

.livelang-settings-table th {
    width: 250px;
    text-align: left;
    padding: 16px 0;
    font-weight: 500;
    vertical-align: top;
    color: var(--livelang-text-main);
}

.livelang-settings-table td {
    padding: 16px 0;
}

.livelang-settings-table select,
.livelang-settings-table input[type="text"],
.livelang-settings-table input[type="number"] {
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--livelang-border);
    border-radius: 8px;
    padding: 8px 12px;
    height: 40px;
}

/* Switch UI */
.livelang-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.livelang-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.livelang-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .4s;
    border-radius: 24px;
}

.livelang-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

input:checked + .livelang-slider {
    background-color: var(--livelang-primary);
}

input:checked + .livelang-slider:before {
    transform: translateX(20px);
}

/* Split Layout for Preview */
.livelang-visual-settings {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 24px;
}

/* Preview Canvas Modern */
.livelang-preview-canvas {
    background: #f1f5f9;
    border-radius: var(--livelang-radius);
    height: 500px;
    position: relative;
    border: 1px solid var(--livelang-border);
    overflow: hidden;
}

.livelang-mock-browser {
    background: #fff;
    margin: 20px;
    height: calc(100% - 40px);
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
}

.livelang-browser-header {
    height: 32px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    padding: 0 12px;
}

.livelang-dot { height: 8px; width: 8px; border-radius: 50%; background: #e2e8f0; margin-right: 6px; }

/* Tables Modern */
.livelang-table {
    width: 100%;
    border-collapse: collapse;
}

.livelang-table th {
    background: #f8fafc;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    border-bottom: 1px solid var(--livelang-border);
    color: var(--livelang-text-muted);
}

.livelang-table td {
    padding: 16px;
    border-bottom: 1px solid var(--livelang-border);
    font-size: 14px;
}

.livelang-table tr:hover {
    background: #fbfcfe;
}

/* Badges */
.livelang-status {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.livelang-status-active { background: #ecfdf5; color: #059669; }
.livelang-status-inactive { background: #fef2f2; color: #dc2626; }

/* Buttons Modern */
.livelang-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 14px;
}

.livelang-btn-primary {
    background: var(--livelang-primary);
    color: #fff;
}

.livelang-btn-primary:hover {
    background: var(--livelang-primary-hover);
    transform: translateY(-1px);
}

.livelang-btn-outline {
    background: #fff;
    border: 1px solid var(--livelang-border);
    color: var(--livelang-text-main);
}

.livelang-btn-outline:hover {
    background: #f8fafc;
}

/* Floating Preview Elements - Refined */
.livelang-floating-preview {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-width: 130px;
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.livelang-floating-preview.is-disabled {
    opacity: 0.2 !important;
    filter: grayscale(1);
    pointer-events: none;
}

.livelang-floating-preview.bottom-right { bottom: 15px !important; right: 15px !important; top: auto !important; left: auto !important; display: flex; flex-direction: column-reverse; }
.livelang-floating-preview.bottom-left { bottom: 15px !important; left: 15px !important; top: auto !important; right: auto !important; display: flex; flex-direction: column-reverse; }
.livelang-floating-preview.top-right { top: 15px !important; right: 15px !important; bottom: auto !important; left: auto !important; display: flex; flex-direction: column; }
.livelang-floating-preview.top-left { top: 15px !important; left: 15px !important; bottom: auto !important; right: auto !important; display: flex; flex-direction: column; }

.livelang-floating-preview.bottom-right .livelang-preview-dropdown,
.livelang-floating-preview.bottom-left .livelang-preview-dropdown {
    margin-top: 0;
    margin-bottom: 6px;
}

.livelang-preview-btn {
    padding: 6px 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    font-size: 12px;
    font-weight: 600;
    cursor: default;
}

.livelang-preview-flag { font-size: 14px; }
.livelang-preview-arrow { font-size: 9px; opacity: 0.5; }

.livelang-preview-dropdown {
    margin-top: 6px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}

.livelang-dropdown-item {
    padding: 8px 12px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid #f1f5f9;
}

.livelang-dropdown-item:last-child { border-bottom: none; }

.livelang-dropdown-item.active {
    font-weight: 700;
    border-left-width: 3px;
    border-left-style: solid;
}

/* Sortable UI */
.ui-sortable-handle {
    cursor: grab;
}
.ui-sortable-helper {
    background: #fff !important;
    box-shadow: 0 10px 20px rgba(0,0,0,0.1) !important;
    display: table !important;
}

/* Modal System - CLASSIC PREMIUM */
.livelang-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.livelang-modal {
    background: #fff;
    width: 100%;
    max-width: 440px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15);
    overflow: hidden;
    border: 1px solid var(--livelang-border);
}

.livelang-modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--livelang-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.livelang-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--livelang-text-main);
    font-weight: 600;
}

.livelang-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--livelang-text-muted);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    margin-right: -4px;
}

.livelang-modal-body {
    padding: 24px;
    font-size: 15px;
    color: var(--livelang-text-main);
    line-height: 1.6;
}

.livelang-modal-footer {
    padding: 16px 24px;
    background: #f8fafc;
    border-top: 1px solid var(--livelang-border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.livelang-modal-footer .livelang-btn {
    padding: 10px 20px;
    font-size: 14px;
    border-radius: 6px;
}

.livelang-modal-fade-in {
    display: flex !important;
    animation: livelangFadeInOverlay 0.3s ease-out forwards;
}

.livelang-modal-fade-in .livelang-modal {
    animation: livelangModalClassicIn 0.3s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
}

@keyframes livelangFadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes livelangModalClassicIn {
    from { opacity: 0; transform: translateY(10px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 1024px) {
    .livelang-main-layout { grid-template-columns: 1fr; }
    .livelang-visual-settings { grid-template-columns: 1fr; }
}
