/* ============================================
   PANEL / DASHBOARD / ADMIN STYLES - COMPLETE
   ============================================ */

/* === PANEL LAYOUT === */
.wp-panel {
    display: flex;
    min-height: 100vh;
    background: var(--wp-dark);
    color: #fff;
    width: 100%;
    overflow-x: hidden;
}

/* Sidebar */
.panel-sidebar {
    width: 250px;
    flex: 0 0 250px;
    min-height: 100vh;
    background: var(--wp-dark-2);
    border-right: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
    /* Desktop: keep it in-flow so nothing renders behind it */
    position: sticky;
    top: 0;
    height: 100vh;
    z-index: 200;
    transition: transform 0.3s ease;
    overflow-y: auto;
}
.sidebar-brand {
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    display: flex; align-items: center; justify-content: space-between;
    flex-shrink: 0;
}
.sidebar-brand h3 { font-size: 19px; font-weight: 800; }
.sidebar-close {
    display: none;
    font-size: 22px; cursor: pointer; color: rgba(255,255,255,0.5);
    background: none; border: none; padding: 4px;
}
.sidebar-nav { padding: 12px 10px; flex: 1; }
.sidebar-link {
    display: flex; align-items: center; gap: 10px;
    padding: 11px 14px; border-radius: 10px;
    font-size: 14px; font-weight: 500;
    color: rgba(255,255,255,0.55);
    transition: all 0.2s; cursor: pointer;
    text-decoration: none; border: none; background: none;
    width: 100%; text-align: left;
    font-family: var(--wp-font);
}
.sidebar-link:hover { background: rgba(255,255,255,0.05); color: #fff; }
.sidebar-link.active { background: rgba(99,102,241,0.15); color: #a5b4fc; font-weight: 600; }
.sidebar-link i { width: 20px; text-align: center; font-size: 14px; flex-shrink: 0; }
.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

/* Sidebar Overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 199;
}

/* Main Content Area */
.panel-main {
    /* In-flow layout (pairs with sticky sidebar) */
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: auto;
    min-width: 0;
    overflow-x: hidden;
}

/* Topbar */
.panel-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 24px;
    background: var(--wp-dark-2);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    position: sticky; top: 0; z-index: 100;
    flex-shrink: 0;
    gap: 12px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.topbar-left h2 { font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-toggle {
    display: none;
    font-size: 20px; cursor: pointer; color: rgba(255,255,255,0.7);
    background: none; border: none; padding: 4px; flex-shrink: 0;
}
.topbar-right { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.trial-badge {
    padding: 5px 14px; border-radius: 50px;
    font-size: 11px; font-weight: 600;
    background: rgba(245,158,11,0.15);
    color: #fbbf24; border: 1px solid rgba(245,158,11,0.3);
    white-space: nowrap;
}
.trial-badge.urgent { background: rgba(239,68,68,0.15); color: #fca5a5; border-color: rgba(239,68,68,0.3); animation: pulse-badge 2s infinite; }
.trial-badge.active-plan { background: rgba(16,185,129,0.15); color: #6ee7b7; border-color: rgba(16,185,129,0.3); }
@keyframes pulse-badge { 0%,100%{opacity:1} 50%{opacity:0.7} }
.topbar-user { font-size: 12px; color: rgba(255,255,255,0.6); white-space: nowrap; }
.topbar-user i { margin-right: 4px; }

/* Tabs */
.panel-tab {
    display: none;
    padding: 24px;
    flex: 1;
    overflow-x: hidden;
}
.panel-tab.active { display: block; }

/* Alert */
.panel-alert {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 16px 20px; border-radius: 12px;
    margin-bottom: 20px; font-size: 13px;
}
.panel-alert.error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2); }
.panel-alert.error i { color: var(--wp-red); font-size: 18px; margin-top: 1px; flex-shrink: 0; }
.panel-alert.warning { background: rgba(245,158,11,0.1); border: 1px solid rgba(245,158,11,0.2); }
.panel-alert.warning i { color: var(--wp-yellow); font-size: 18px; margin-top: 1px; flex-shrink: 0; }
.panel-alert strong { display: block; margin-bottom: 3px; font-size: 14px; }
.panel-alert p { opacity: 0.7; font-size: 12px; margin: 0; }

/* Tab Headers */
.tab-title { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.tab-subtitle { font-size: 13px; color: rgba(255,255,255,0.5); margin-bottom: 24px; }

/* === DASHBOARD CARDS === */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}
.dash-card {
    padding: 22px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--wp-radius);
}
.dash-card-icon {
    width: 46px; height: 46px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px; font-size: 18px; color: #fff;
    margin-bottom: 14px;
}
.dash-card-info span { font-size: 12px; color: rgba(255,255,255,0.5); }
.dash-card-info strong { display: block; font-size: 17px; font-weight: 700; margin-top: 3px; }
.dash-card-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.dash-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 7px 14px; border-radius: 8px;
    font-size: 12px; font-weight: 600;
    font-family: var(--wp-font);
    border: none; cursor: pointer;
    transition: all 0.2s; text-decoration: none;
}
.dash-btn.view { background: rgba(99,102,241,0.15); color: #a5b4fc; }
.dash-btn.share { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.dash-btn.edit { background: rgba(245,158,11,0.15); color: #fbbf24; }
.dash-btn:hover { transform: scale(1.04); }

/* Existing Page Info */
.existing-page-info {
    padding: 24px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--wp-radius);
}
.page-info-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.page-info-header h3 { font-size: 18px; }
.page-info-header h3 i { margin-right: 6px; opacity: 0.6; }
.page-status { padding: 4px 12px; border-radius: 50px; font-size: 11px; font-weight: 600; }
.page-status.active { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.page-url-box {
    display: flex; align-items: center; gap: 8px;
    padding: 10px 14px;
    background: rgba(0,0,0,0.3);
    border-radius: 10px; margin-bottom: 16px;
}
.page-url-box span { flex: 1; font-size: 12px; color: #a5b4fc; word-break: break-all; min-width: 0; }
.page-url-box button {
    background: rgba(99,102,241,0.2); border: none;
    color: #a5b4fc; padding: 7px 10px; border-radius: 8px;
    cursor: pointer; font-size: 13px; transition: background 0.2s; flex-shrink: 0;
}
.page-url-box button:hover { background: rgba(99,102,241,0.3); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* === TEMPLATES GRID === */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.template-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--wp-radius);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s;
}
.template-card:hover {
    transform: translateY(-4px);
    border-color: rgba(99,102,241,0.4);
    box-shadow: 0 12px 30px rgba(0,0,0,0.2);
}
.template-preview {
    height: 180px;
    display: flex; align-items: center; justify-content: center;
    padding: 16px; position: relative;
}
.template-mock {
    width: 88%; padding: 12px;
    background: rgba(0,0,0,0.25);
    border-radius: 8px;
}
.tmock-nav { height: 5px; width: 55%; background: rgba(255,255,255,0.15); border-radius: 3px; margin-bottom: 12px; }
.tmock-hero { text-align: center; margin-bottom: 10px; }
.tmock-title { height: 10px; width: 65%; background: rgba(255,255,255,0.25); border-radius: 4px; margin: 0 auto 6px; }
.tmock-text { height: 5px; width: 80%; background: rgba(255,255,255,0.1); border-radius: 3px; margin: 0 auto 8px; }
.tmock-btn { height: 14px; width: 50px; background: rgba(255,255,255,0.3); border-radius: 7px; margin: 0 auto; }
.tmock-cards { display: flex; gap: 5px; }
.tmock-card { flex: 1; height: 35px; background: rgba(255,255,255,0.08); border-radius: 5px; }
.tmock-search { height: 12px; width: 55%; background: rgba(255,255,255,0.1); border-radius: 6px; margin: 8px auto; }
.tmock-product-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.tmock-product { height: 40px; background: rgba(255,255,255,0.08); border-radius: 5px; }

.template-info { padding: 14px; }
.template-info h4 { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.template-info p { font-size: 11px; color: rgba(255,255,255,0.5); margin-bottom: 6px; }
.template-category {
    display: inline-block; font-size: 9px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px;
    padding: 3px 9px; border-radius: 50px;
    background: rgba(99,102,241,0.12); color: #a5b4fc;
}
.btn-select-template {
    width: 100%; padding: 11px;
    background: rgba(99,102,241,0.1);
    border: none; border-top: 1px solid rgba(255,255,255,0.05);
    color: #a5b4fc; font-weight: 700; font-size: 12px;
    font-family: var(--wp-font);
    cursor: pointer; transition: all 0.2s;
}
.btn-select-template:hover { background: rgba(99,102,241,0.2); }

/* === SETTINGS === */
.settings-form {
    max-width: 480px;
    padding: 24px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: var(--wp-radius);
}
.settings-logo-section { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.current-logo img, .logo-placeholder {
    width: 70px; height: 70px;
    border-radius: 14px; object-fit: cover;
    background: rgba(255,255,255,0.05);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; color: rgba(255,255,255,0.2);
}
.settings-form .form-group { margin-bottom: 14px; }
.settings-form label { display: block; font-size: 11px; font-weight: 600; color: rgba(255,255,255,0.5); margin-bottom: 5px; }
.settings-form input[type="text"],
.settings-form input[type="tel"],
.settings-form input[type="url"] {
    width: 100%; padding: 10px 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px; color: #fff;
    font-family: var(--wp-font); font-size: 13px; outline: none;
}
.settings-form input:focus { border-color: rgba(99,102,241,0.4); }

/* ============================================
   ADMIN PANEL
   ============================================ */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.admin-stat-card {
    display: flex; align-items: center; gap: 14px;
    padding: 18px 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
}
.stat-icon {
    width: 44px; height: 44px; min-width: 44px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 11px; font-size: 18px; color: #fff;
}
.admin-stat-card span { font-size: 11px; color: rgba(255,255,255,0.5); }
.admin-stat-card strong { display: block; font-size: 24px; font-weight: 800; margin-top: 2px; }

.admin-search {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 16px; background: rgba(255,255,255,0.05);
    border-radius: 50px; margin-bottom: 16px; max-width: 360px; width: 100%;
}
.admin-search i { color: rgba(255,255,255,0.3); flex-shrink: 0; }
.admin-search input {
    flex: 1; border: none; background: none;
    color: #fff; font-family: var(--wp-font);
    font-size: 13px; outline: none; min-width: 0;
}

.admin-table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
}
.admin-table {
    width: 100%; border-collapse: collapse;
    font-size: 13px;
    min-width: 700px;
}
.admin-table thead th {
    padding: 11px 12px; text-align: left;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
    color: rgba(255,255,255,0.4);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    white-space: nowrap;
    position: sticky; top: 0; background: var(--wp-dark-2);
}
.admin-table tbody td {
    padding: 12px; border-bottom: 1px solid rgba(255,255,255,0.04);
    vertical-align: middle;
}
.admin-table tbody tr:hover { background: rgba(255,255,255,0.02); }

.business-cell { display: flex; align-items: center; gap: 8px; }
.business-mini-logo { width: 30px; height: 30px; border-radius: 7px; object-fit: cover; flex-shrink: 0; }

.plan-badge, .status-badge {
    padding: 3px 9px; border-radius: 50px;
    font-size: 10px; font-weight: 600; white-space: nowrap;
    display: inline-block;
}
.plan-badge.trial { background: rgba(245,158,11,0.15); color: #fbbf24; }
.plan-badge.paid { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.status-badge.active { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.status-badge.suspended { background: rgba(245,158,11,0.15); color: #fbbf24; }
.status-badge.blocked { background: rgba(239,68,68,0.15); color: #fca5a5; }

.admin-actions { display: flex; gap: 4px; }
.admin-btn {
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    border: none; border-radius: 7px;
    cursor: pointer; font-size: 11px;
    transition: all 0.2s;
}
.admin-btn.activate { background: rgba(16,185,129,0.15); color: #6ee7b7; }
.admin-btn.suspend { background: rgba(245,158,11,0.15); color: #fbbf24; }
.admin-btn.block { background: rgba(239,68,68,0.15); color: #fca5a5; }
.admin-btn.delete { background: rgba(239,68,68,0.25); color: #fca5a5; }
.admin-btn:hover { transform: scale(1.12); }

/* ============================================
   RESPONSIVE - TABLET (max 900px)
   ============================================ */
@media (max-width: 900px) {
    .panel-sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        height: 100vh;
        transform: translateX(-100%);
        z-index: 300;
    }
    .panel-sidebar.active { transform: translateX(0); }
    .sidebar-overlay.active { display: block; }
    .sidebar-close { display: block; }
    .panel-main { width: 100%; }
    .menu-toggle { display: block; }
    .templates-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
    .admin-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================
   RESPONSIVE - MOBILE (max 600px)
   ============================================ */
@media (max-width: 600px) {
    .panel-topbar { padding: 12px 16px; }
    .topbar-left h2 { font-size: 15px; }
    .topbar-user { display: none; }
    .trial-badge { font-size: 10px; padding: 4px 10px; }

    .panel-tab { padding: 16px 14px; }
    .tab-title { font-size: 19px; }
    .tab-subtitle { font-size: 12px; margin-bottom: 18px; }

    .dashboard-cards { grid-template-columns: 1fr; }
    .templates-grid { grid-template-columns: 1fr; }

    .admin-stats { grid-template-columns: 1fr 1fr; gap: 10px; }
    .admin-stat-card { padding: 14px 12px; }
    .admin-stat-card strong { font-size: 20px; }

    .existing-page-info { padding: 18px 14px; }
    .page-info-header h3 { font-size: 16px; }
    .page-actions { flex-direction: column; }
    .page-actions .btn-primary, .page-actions .btn-secondary,
    .page-actions .dash-btn { width: 100%; justify-content: center; text-align: center; }
    .page-url-box { flex-wrap: wrap; }
    .page-url-box span { font-size: 11px; }

    .settings-form { padding: 18px 14px; }
}

/* ============================================
   RESPONSIVE - VERY SMALL (max 380px)
   ============================================ */
@media (max-width: 380px) {
    .panel-topbar { padding: 10px 12px; }
    .panel-tab { padding: 12px 10px; }
    .admin-stats { grid-template-columns: 1fr; }
    .templates-grid { grid-template-columns: 1fr; gap: 12px; }
    .template-preview { height: 150px; }
}
