/**
 * VTS Admin Styles
 */

.vts-wrap {
    margin: 20px 20px 0 2px;
}

.vts-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    background: #f0f0f1;
}

.sidebar-toggle {
    position: absolute;
    left: 280px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    width: 20px;
    height: 60px;
    background: #fff;
    border: 1px solid #ccd0d4;
    border-left: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 2px 0 5px rgba(0,0,0,0.05);
    transition: left 0.3s ease;
}

.sidebar-toggle:hover {
    background: #f6f7f7;
    color: #2271b1;
}

.sidebar-toggle .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.vts-sidebar {
    width: 280px;
    min-width: 280px;
    background: #fff;
    border-right: 1px solid #ccd0d4;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s ease;
}

.vts-container.sidebar-collapsed .vts-sidebar {
    width: 0;
    min-width: 0;
    border-right: none;
}

.vts-container.sidebar-collapsed .sidebar-toggle {
    left: 0;
}

.sidebar-header {
    padding: 15px;
    border-bottom: 1px solid #e2e4e7;
}

.sidebar-header h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #1d2327;
}

.view-mode-selector {
    display: flex;
    background: #f0f0f1;
    padding: 3px;
    border-radius: 6px;
}

.view-mode-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 6px 4px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 4px;
    color: #646970;
    transition: all 0.2s;
}

.view-mode-btn.active {
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    color: #2271b1;
}

.nav-item {
    padding: 10px 14px; /* More side padding */
    cursor: pointer;
    border-radius: 3px; /* Sharper radius */
    margin-bottom: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #50575e;
    font-size: 13px;
}

.nav-item:hover {
    background: #f0f6fb;
    color: #2271b1;
}

.nav-item.active {
    background: #e5f3ff;
    color: #2271b1;
    font-weight: 600;
}

.cat-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cat-stat {
    font-size: 11px;
    color: #1d2327;
    font-weight: 700; /* Bold numbers */
    min-width: 18px;
    text-align: right;
    margin-left: 10px;
}

.nav-item.active .cat-stat {
    color: #2271b1;
}

.vts-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px 25px; /* Clean breathing room */
}

.cat-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.cat-stat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f1;
    font-size: 14px;
}

.cat-stat:last-child {
    border-bottom: none;
}

.sidebar-footer {
    padding: 15px;
    border-top: 1px solid #ccd0d4;
    background: #f8f9fa;
}

.btn-primary {
    width: 100%;
    padding: 10px;
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s;
}

.btn-primary:hover:not(:disabled) {
    background: #135e96;
}

.btn-primary:disabled {
    background: #a7aaad;
    cursor: not-allowed;
}

/* Main Area */
.vts-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #ccd0d4;
    border-radius: 4px;
    padding: 0;
    box-shadow: 0 1px 1px rgba(0,0,0,.04);
}

.builder-rows {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.builder-row {
    position: relative;
    border: none;
    border-radius: 0;
    background: #fff;
    overflow: visible; /* Allow header to float */
    margin-bottom: 0;
}

.row-header {
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e2e4e7;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.builder-row:hover .row-header {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.dna-tags {
    display: flex;
    gap: 8px;
}

.dna-tag {
    background: #f0f0f1;
    color: #50575e;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
    border: 1px solid #dcdcde;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cat-badge {
    background: #e0f0fa;
    color: #2271b1;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.row-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.icon-btn {
    background: none;
    border: 1px solid #ccd0d4;
    border-radius: 3px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #3c434a;
    transition: all 0.2s;
}

.icon-btn.active {
    background: #e2e4e7;
    border-color: #2271b1;
    color: #2271b1;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.responsive-toggles {
    display: flex;
    gap: 4px;
    margin-right: 15px;
    padding-right: 15px;
    border-right: 1px solid #e2e4e7;
}

.icon-btn:hover:not(:disabled) {
    background: #f0f0f1;
    border-color: #2271b1;
    color: #2271b1;
}

.icon-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.counter {
    font-size: 13px;
    font-weight: 500;
    color: #3c434a;
    min-width: 60px;
    text-align: center;
}

.row-content {
    padding: 0;
    min-height: 150px;
    display: flex;
    justify-content: center;
    background: #fff;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.vts-preview-container {
    width: 100%;
    margin: 0 auto;
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.vts-preview-container.is-tablet {
    width: 768px !important;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
}

.vts-preview-container.is-mobile {
    width: 360px !important;
    border-left: 1px solid #ddd;
    border-right: 1px solid #ddd;
}

.row-content .elementor {
    width: 100%;
}

.vts-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #8c8f94;
}

.spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #2271b1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Skeleton Loaders */
.vts-skeleton {
    width: 100%;
    padding: 30px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.skeleton-block {
    height: 20px;
    background: #f0f0f1;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.skeleton-block::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.2) 20%,
        rgba(255, 255, 255, 0.5) 60%,
        rgba(255, 255, 255, 0)
    );
    animation: shimmer 1.5s infinite;
}

.skeleton-hero { height: 150px; width: 100%; }
.skeleton-title { height: 30px; width: 60%; }
.skeleton-text { height: 15px; width: 90%; }
.skeleton-text-sm { height: 15px; width: 40%; }

@keyframes shimmer {
    100% { transform: translateX(100%); }
}

/* Improved transitions for new content */
.vts-preview-container iframe {
    opacity: 0;
    transition: opacity 0.3s ease-in;
}

.vts-preview-container iframe.loaded {
    opacity: 1;
}

/* Specific CSS to ensure Elementor previews look ok in admin */
.row-content .elementor-custom-vts {
    width: 100%;
}
.row-content img {
    max-width: 100%;
    height: auto;
}
