/* ===================================
   Beedy — Dashboard Stylesheet
   =================================== */

/* --- Dashboard Layout --- */
.dashboard-page {
    display: flex;
    min-height: 100vh;
    overflow: hidden;
}

/* --- Sidebar --- */
.sidebar {
    width: 260px;
    min-width: 260px;
    background: #060810;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

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

.sidebar-close {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.sidebar-nav ul {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition);
}

.sidebar-nav a:hover {
    background: rgba(220,38,38,0.08);
    color: var(--text-primary);
}

.sidebar-nav a.active {
    background: rgba(220,38,38,0.12);
    color: var(--primary-light);
}

.sidebar-nav svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

/* --- Main Content --- */
.dash-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-y: auto;
}

/* --- Top Bar --- */
.dash-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 32px;
    border-bottom: 1px solid var(--border);
    background: rgba(8,10,15,0.8);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.sidebar-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.sidebar-toggle span {
    width: 22px;
    height: 2px;
    background: var(--text-primary);
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 500;
}

.user-avatar-sm {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gradient-1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
}

/* --- Dashboard Content --- */
.dash-content {
    padding: 32px;
    flex: 1;
}

.dash-page {
    display: none;
}

.dash-page.active {
    display: block;
}

.dash-page-header {
    margin-bottom: 32px;
}

.dash-page-header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.dash-page-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* --- Stats Cards --- */
.dash-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 40px;
}

.dash-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.dash-stat-icon {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dash-stat-icon svg {
    width: 24px;
    height: 24px;
}

.dash-stat-icon.blue { background: rgba(220,38,38,0.12); color: var(--primary-light); }
.dash-stat-icon.green { background: rgba(5,150,105,0.12); color: var(--success-light); }
.dash-stat-icon.purple { background: rgba(239,68,68,0.12); color: #F87171; }
.dash-stat-icon.cyan { background: rgba(6,182,212,0.12); color: var(--accent-light); }

.dash-stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.2;
}

.dash-stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- Dashboard Sections --- */
.dash-section {
    margin-bottom: 40px;
}

.dash-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.dash-section-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

/* --- License Cards --- */
.license-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.license-info h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.license-tier {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tier-starter { background: rgba(6,182,212,0.12); color: var(--accent-light); }
.tier-professional { background: rgba(220,38,38,0.12); color: var(--primary-light); }
.tier-enterprise { background: rgba(217,119,6,0.12); color: var(--warning); }

.license-meta {
    display: flex;
    gap: 20px;
    margin-top: 8px;
}

.license-meta span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.license-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* --- Dashboard Products Grid --- */
.dash-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.dash-product-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 28px;
    transition: all var(--transition);
}

.dash-product-card:hover {
    border-color: rgba(220,38,38,0.3);
}

.dash-product-card h4 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.dash-product-card .product-tagline {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 12px;
    display: block;
}

.dash-product-card p {
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.6;
    margin-bottom: 16px;
}

.dash-product-card .product-pricing-preview {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-bottom: 16px;
}

.dash-product-card .btn { width: 100%; }

.subscribed-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    background: rgba(5,150,105,0.12);
    color: var(--success-light);
    font-size: 0.8rem;
    font-weight: 600;
    width: 100%;
    justify-content: center;
}

.coming-soon-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: rgba(234,179,8,0.15);
    color: #eab308;
    margin-left: 8px;
    vertical-align: middle;
}

/* --- Team List --- */
.team-member-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.team-member-row .user-avatar-sm {
    width: 40px;
    height: 40px;
}

.team-member-info {
    flex: 1;
}

.team-member-info h4 {
    font-size: 0.9rem;
    font-weight: 600;
}

.team-member-info span {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- Billing --- */
.billing-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

.billing-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 28px;
}

.billing-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.billing-amount {
    font-size: 2rem;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.billing-card p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.payment-display {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1rem;
    font-weight: 600;
}

.card-icon {
    font-size: 1.5rem;
}

/* --- Dashboard Table --- */
.dash-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.dash-table th,
.dash-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
}

.dash-table thead th {
    background: rgba(220,38,38,0.06);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.dash-table td { color: var(--text-secondary); }
.dash-table td:first-child { color: var(--text-primary); font-weight: 500; }

/* --- Status Badges --- */
.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
}

.status-active { background: rgba(5,150,105,0.12); color: var(--success-light); }
.status-inactive { background: rgba(107,114,128,0.12); color: var(--text-muted); }
.status-pending { background: rgba(217,119,6,0.12); color: var(--warning); }

/* --- Access Badges --- */
.access-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.access-badge {
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 0.65rem;
    font-weight: 600;
    background: rgba(220,38,38,0.1);
    color: var(--primary-light);
}

/* --- Admin Page --- */
.admin-capacity {
    margin-bottom: 32px;
}

.capacity-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 28px;
}

.capacity-card h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.capacity-bar-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
}

.capacity-bar {
    flex: 1;
    height: 12px;
    background: var(--border);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.capacity-fill {
    height: 100%;
    background: var(--gradient-1);
    border-radius: var(--radius-full);
    transition: width 0.5s ease;
}

.capacity-text {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
}

.capacity-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.access-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.access-checkboxes label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all var(--transition);
}

.access-checkboxes label:hover {
    border-color: var(--primary-light);
}

.access-checkboxes input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
}

.users-table-wrap {
    overflow-x: auto;
}

.member-count {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* --- Settings --- */
.settings-form-wrap {
    max-width: 640px;
}

.settings-form-wrap .settings-form {
    background: none;
    border: none;
    padding: 0;
}

.settings-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 40px 0;
}

.danger-zone h3 {
    color: var(--danger-light);
    font-size: 1.1rem;
    margin-bottom: 8px;
}

.danger-zone p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 16px;
}

/* --- Modal --- */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    overflow-y: auto;
    margin: 20px;
}

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

.modal-header h2 {
    font-size: 1.2rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px 28px;
}

.modal-body > p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.modal-footer {
    padding: 16px 28px 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* --- Tier Selector --- */
.tier-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.tier-option {
    cursor: pointer;
}

.tier-option input[type="radio"] {
    display: none;
}

.tier-card {
    background: var(--bg-dark);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px 16px;
    text-align: center;
    transition: all var(--transition);
}

.tier-option input:checked + .tier-card {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(220,38,38,0.2);
}

.tier-card h4 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.tier-price {
    font-size: 1.3rem;
    font-weight: 800;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 12px;
}

.tier-card ul {
    text-align: left;
}

.tier-card li {
    font-size: 0.8rem;
    color: var(--text-secondary);
    padding: 3px 0 3px 16px;
    position: relative;
}

.tier-card li::before {
    content: '\2713';
    position: absolute;
    left: 0;
    color: var(--accent);
    font-weight: 700;
    font-size: 0.75rem;
}

/* --- Responsive Dashboard --- */
@media (max-width: 1024px) {
    .dash-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .billing-summary {
        grid-template-columns: 1fr;
    }

    .tier-selector {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        transform: translateX(-100%);
        z-index: 200;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-close {
        display: block;
    }

    .sidebar-toggle {
        display: flex;
    }

    .dash-content {
        padding: 20px;
    }

    .dash-stats {
        grid-template-columns: 1fr;
    }

    .dash-topbar {
        padding: 12px 20px;
    }

    .license-card {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* --- Dynamic Sidebar Apps Divider --- */
.sidebar-apps-divider {
    list-style: none;
    padding: 16px 24px 6px;
    margin: 0;
}
.sidebar-apps-divider span {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    opacity: 0.6;
}

/* --- Sidebar App Group (collapsible section) --- */
.sidebar-app-group {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-group-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 24px;
    color: var(--text-secondary, #9ca3af);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.sidebar-group-header:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-primary, #e5e7eb);
}

.sidebar-group-header svg:first-child {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.group-chevron {
    margin-left: auto;
    flex-shrink: 0;
    transition: transform 0.25s ease;
    opacity: 0.5;
}

.sidebar-app-group.expanded .group-chevron {
    transform: rotate(90deg);
}

.sidebar-group-items {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

.sidebar-app-group.expanded .sidebar-group-items {
    max-height: 300px;
}

.sidebar-group-items li a {
    padding-left: 40px;
}

.sidebar-group-items li a svg {
    width: 16px;
    height: 16px;
}

/* Collapsed sidebar: hide group text, show only icon */
.sidebar.collapsed .sidebar-group-header {
    padding: 12px;
    justify-content: center;
}

.sidebar.collapsed .sidebar-group-header span,
.sidebar.collapsed .group-chevron {
    display: none;
}

.sidebar.collapsed .sidebar-group-items li a {
    padding-left: 12px;
    justify-content: center;
}

/* --- Generic App Placeholder Page --- */
.app-placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 80px);
    padding: 40px 24px;
}
.app-placeholder-inner {
    text-align: center;
    max-width: 480px;
}
.app-placeholder-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 72px;
    height: 72px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(229, 57, 53, 0.15), rgba(229, 57, 53, 0.05));
    margin-bottom: 24px;
}
.app-placeholder-icon svg {
    width: 36px;
    height: 36px;
    stroke: #e53935;
}
.app-placeholder-inner h1 {
    font-size: 1.8rem;
    margin-bottom: 8px;
}
.app-placeholder-tagline {
    color: var(--text-muted);
    font-size: 1rem;
    margin-bottom: 20px;
}
.app-placeholder-tier {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 32px;
    font-size: 0.9rem;
    color: var(--text-muted);
}
.app-placeholder-badge {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 32px 24px;
    margin-bottom: 24px;
}
.app-placeholder-badge-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}
.app-placeholder-badge h2 {
    font-size: 1.3rem;
    margin-bottom: 8px;
    color: #e53935;
}
.app-placeholder-badge p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin: 0;
}

/* --- Floating Help Button --- */
.help-fab {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #DC2626;
    color: #ffffff;
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.4);
    z-index: 9999;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.help-fab:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 24px rgba(220, 38, 38, 0.6);
}
