/* =============================================================================
   AlohaOne App — Styles
   Based on AlohaCommerce admin (Bootstrap 5) with tropical AlohaOne branding
   ============================================================================= */

:root {
    --ao-primary: #0891b2;           /* ocean teal */
    --ao-primary-dark: #0e7490;
    --ao-accent: #ec4899;            /* hibiscus */
    --ao-sunset: #f97316;            /* sunset */
    --ao-sunshine: #fbbf24;
    --ao-tropical: #22c55e;          /* palm */
    --ao-sidebar-bg: #083344;        /* deep ocean (matches marketing hero) */
    --ao-sidebar-width: 240px;
    --ao-gradient: linear-gradient(135deg, #0891b2 0%, #ec4899 55%, #f97316 100%);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: #f8f9fa;
}

/* --- Sidebar --- */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--ao-sidebar-width);
    height: 100vh;
    background: var(--ao-sidebar-bg);
    padding-top: 1rem;
    overflow-y: auto;
    z-index: 1000;
}

.sidebar .brand {
    color: #fff;
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.3px;
    padding: 0.5rem 1rem 1.5rem;
    text-decoration: none;
    display: block;
}

/* Tropical "AlohaOne" wordmark — ocean → hibiscus → sunset gradient */
.sidebar .brand .brand-gradient {
    background: var(--ao-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.7);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: 0;
    transition: background 0.15s;
}

.sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.sidebar .nav-link.active {
    color: #fff;
    background: rgba(8, 145, 178, 0.3);
    border-left: 3px solid var(--ao-primary);
}

.sidebar .nav-link i {
    width: 20px;
    margin-right: 0.5rem;
    text-align: center;
}

.sidebar .nav-section {
    color: rgba(255, 255, 255, 0.4);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 1rem 1rem 0.25rem;
    margin-top: 0.5rem;
}

/* Current user block at top */
.sidebar .sidebar-user {
    padding: 0 1rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 0.25rem;
}
.sidebar .sidebar-user .user-name {
    color: #fff;
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar .sidebar-user .user-role {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Sign Out at the bottom of the nav flow */
.sidebar .sidebar-signout {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 1rem;
    padding: 0.5rem 0 1rem;
}

/* --- Main Content --- */

.main-content {
    margin-left: var(--ao-sidebar-width);
    padding: 1.5rem 2rem;
    min-height: 100vh;
}

/* --- Top Bar --- */

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.top-bar h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

/* --- Buttons — tropical primary --- */

.btn-primary {
    background: var(--ao-primary);
    border-color: var(--ao-primary);
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--ao-primary-dark);
    border-color: var(--ao-primary-dark);
}

.btn-tropical {
    background: var(--ao-gradient);
    color: #fff;
    border: none;
    font-weight: 600;
}
.btn-tropical:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(236, 72, 153, 0.35);
}

/* --- Cards / Stats --- */

.stat-card {
    border: none;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--ao-primary-dark);
}

.stat-card .stat-label {
    font-size: 0.85rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-card .stat-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: #fff;
    margin-bottom: 0.75rem;
}

/* --- Platform cards (for dashboard / platforms list) --- */

.platform-card {
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 1.25rem;
    background: #fff;
    transition: all 0.2s;
    height: 100%;
    position: relative;
}
.platform-card:hover {
    border-color: var(--ao-primary);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
.platform-card.enabled {
    border-color: var(--ao-tropical);
    background: linear-gradient(180deg, #fff 0%, #f0fdf4 100%);
}
.platform-card .platform-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    color: #fff;
    margin-bottom: 0.75rem;
}
.platform-card h5 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}
.platform-card .platform-tagline {
    font-size: 0.82rem;
    color: #6c757d;
    line-height: 1.4;
    margin-bottom: 0.75rem;
}
.platform-card .platform-status {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.2rem 0.6rem;
    border-radius: 50px;
    display: inline-block;
}
.platform-card .status-enabled { background: #dcfce7; color: #15803d; }
.platform-card .status-available { background: #e0f2fe; color: #0369a1; }
.platform-card .status-coming { background: #fed7aa; color: #c2410c; }
.platform-card .status-bundled { background: #fef3c7; color: #a16207; }

/* --- Tables --- */

.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: #6c757d;
    border-top: none;
    letter-spacing: 0.03em;
}

.table td {
    vertical-align: middle;
}

.table .actions {
    white-space: nowrap;
}

/* --- Auth pages (login / register) --- */

.auth-page {
    min-height: 100vh;
    background: var(--ao-sidebar-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}
.auth-page::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 15% 20%, rgba(236, 72, 153, 0.25) 0%, transparent 50%),
        radial-gradient(circle at 85% 30%, rgba(249, 115, 22, 0.22) 0%, transparent 50%),
        radial-gradient(circle at 70% 85%, rgba(251, 191, 36, 0.18) 0%, transparent 55%),
        radial-gradient(circle at 20% 90%, rgba(34, 197, 94, 0.15) 0%, transparent 50%);
}
.auth-card {
    position: relative;
    z-index: 2;
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem 2.25rem;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}
.auth-card .brand {
    font-size: 1.75rem;
    font-weight: 800;
    text-align: center;
    color: #083344;
    margin-bottom: 0.5rem;
    letter-spacing: -0.5px;
}
.auth-card .brand-gradient {
    background: var(--ao-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.auth-card .auth-subtitle {
    text-align: center;
    color: #6c757d;
    font-size: 0.9rem;
    margin-bottom: 1.75rem;
}
.auth-card .form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #334155;
}
.auth-card .btn-primary {
    background: var(--ao-gradient);
    border: none;
    padding: 0.65rem;
    font-weight: 600;
}
.auth-card .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.35);
}
.auth-card .auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.9rem;
    color: #6c757d;
}
.auth-card .auth-footer a {
    color: var(--ao-primary);
    font-weight: 600;
    text-decoration: none;
}
.auth-card .auth-footer a:hover { text-decoration: underline; }

/* --- Enable Platform page --- */

.enable-hero {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.75rem;
    background: linear-gradient(135deg, #fff 0%, #f0f9ff 100%);
    border: 1px solid #dee2e6;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}
.enable-hero .enable-icon {
    width: 72px;
    height: 72px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: #fff;
    flex-shrink: 0;
}
.enable-hero h2 {
    margin: 0 0 0.25rem 0;
    font-size: 1.5rem;
    font-weight: 700;
}
.enable-hero p {
    margin: 0;
    color: #475569;
}

.capability-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 1px solid #f1f5f9;
}
.capability-row:last-child { border-bottom: none; }
.capability-row .cap-info h6 {
    margin: 0 0 0.25rem 0;
    font-size: 0.95rem;
    font-weight: 600;
}
.capability-row .cap-info p {
    margin: 0;
    font-size: 0.82rem;
    color: #6c757d;
}
.capability-row .form-check-input {
    width: 2.5rem;
    height: 1.35rem;
    margin: 0;
}

/* --- Empty State --- */

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #cbd5e1;
}

/* --- Responsive (legacy MPA pages only) --- */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s;
    }
    .sidebar.show {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
}

/* =============================================================================
   APP SHELL — title bar, dropdown, content area
   The shell is the new entry point at index.html. Everything below is for it.
   ============================================================================= */

.app-shell {
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ── Title bar ───────────────────────────────────────────────────────────── */

.app-titlebar {
    flex: 0 0 60px;
    background: var(--ao-sidebar-bg);
    display: flex;
    align-items: center;
    padding: 0 1rem 0 1.25rem;
    gap: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 1050;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.app-titlebar .app-brand {
    color: #fff;
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.3px;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 0 0 auto;
}
.app-titlebar .app-brand .brand-flower {
    font-size: 1rem;
}
.app-titlebar .app-brand:hover {
    opacity: 0.85;
}

/* Platform switcher button */
.platform-switcher {
    flex: 0 0 auto;
    margin-left: 0.75rem;
}
.btn-platform-switcher {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 0.45rem 1rem;
    font-weight: 600;
    font-size: 0.92rem;
    min-width: 220px;
    text-align: left;
    display: flex;
    align-items: center;
    transition: background 0.15s;
}
.btn-platform-switcher:hover, .btn-platform-switcher:focus {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.25);
}
.btn-platform-switcher::after {
    margin-left: auto;
}

/* The dropdown panel itself */
.platform-dropdown-menu {
    min-width: 360px;
    max-height: 70vh;
    overflow-y: auto;
    padding: 0.5rem 0;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.15);
}
.platform-dropdown-menu .dropdown-header {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6c757d;
    padding: 0.5rem 1rem 0.25rem;
    margin: 0;
}
.platform-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
}
.platform-dropdown-item:hover {
    background: #f8f9fa;
}
.platform-dropdown-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 32px;
    font-size: 0.92rem;
}
.platform-dropdown-text {
    display: flex;
    flex-direction: column;
    line-height: 1.25;
    flex: 1;
}
.platform-dropdown-text strong {
    font-size: 0.92rem;
    color: #1f2937;
}
.platform-dropdown-text small {
    font-size: 0.72rem;
}
.opacity-60 {
    opacity: 0.65;
}

/* Title bar right-side actions */
.titlebar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.btn-titlebar {
    background: transparent;
    color: rgba(255, 255, 255, 0.85);
    border: none;
    border-radius: 8px;
    padding: 0.5rem 0.7rem;
    position: relative;
    transition: background 0.15s;
}
.btn-titlebar:hover, .btn-titlebar:focus {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}
.notification-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--ao-accent);
    color: #fff;
    font-size: 0.62rem;
    font-weight: 700;
    padding: 0.1rem 0.35rem;
    border-radius: 999px;
    min-width: 16px;
    text-align: center;
    line-height: 1.2;
}

/* Account dropdown */
.account-dropdown .account-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.6rem;
}
.account-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--ao-gradient);
    color: #fff;
    font-weight: 700;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.account-name {
    font-size: 0.88rem;
    font-weight: 500;
}

/* ── Content area ───────────────────────────────────────────────────────── */

.app-content {
    flex: 1 1 auto;
    overflow: auto;
    background: #f8f9fa;
    position: relative;
}

.app-content.app-content-embedded {
    padding: 0;
    overflow: hidden;
}
.app-content.app-content-embedded iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.app-content.app-content-native {
    padding: 0;
}

.app-content-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6c757d;
}
.app-content-loading i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--ao-primary);
}

.native-view-wrap {
    padding: 1.75rem 2rem 3rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* ── Native view: System Dashboard ──────────────────────────────────────── */

.system-dashboard .dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e5e7eb;
}
.system-dashboard .dashboard-header h1 {
    font-size: 1.65rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
}

.kpi-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.25rem;
    height: 100%;
}
.kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    margin-bottom: 0.75rem;
}
.kpi-value {
    font-size: 1.6rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.2;
}
.kpi-label {
    font-size: 0.78rem;
    color: #64748b;
    margin-top: 0.15rem;
}
.kpi-trend {
    font-size: 0.78rem;
    margin-top: 0.35rem;
}

.dashboard-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    height: 100%;
}
.dashboard-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #f1f5f9;
}
.dashboard-card-header h5 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
}
.dashboard-card-body {
    padding: 1rem 1.25rem;
}

.health-list { list-style: none; padding: 0; margin: 0; }
.health-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.88rem;
}
.health-item:last-child { border-bottom: none; }

.activity-feed .activity-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid #f1f5f9;
}
.activity-feed .activity-item:last-child { border-bottom: none; }
.activity-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: #f0f9ff;
    color: #0891b2;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
}
.activity-body { flex: 1; font-size: 0.88rem; }
.activity-detail { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.72rem; }

.drill-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    text-decoration: none;
    color: #1f2937;
    text-align: center;
    font-size: 0.85rem;
    transition: all 0.15s;
    background: #fff;
}
.drill-tile:hover {
    border-color: var(--ao-primary);
    color: var(--ao-primary);
    transform: translateY(-1px);
}
.drill-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Native view: Home tile grid ────────────────────────────────────────── */

.home-view .home-header {
    margin-bottom: 2rem;
}
.home-view .home-header h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0 0 0.25rem 0;
}

.home-section {
    margin-bottom: 2rem;
}
.home-section-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 1rem;
}
.home-section-header h2 {
    font-size: 1.05rem;
    font-weight: 600;
    margin: 0;
    color: #334155;
}

.home-tile {
    display: block;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    height: 100%;
}
.home-tile:hover {
    border-color: var(--ao-primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}
.home-tile.enabled {
    border-color: #d1fae5;
    background: linear-gradient(180deg, #fff 0%, #f0fdf4 100%);
}
.home-tile-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
}
.home-tile-name {
    font-weight: 700;
    font-size: 0.98rem;
    color: #0f172a;
    margin-bottom: 0.25rem;
}
.home-tile-stat {
    font-size: 0.78rem;
    margin-bottom: 0.75rem;
    line-height: 1.4;
    min-height: 2.2em;
}
.home-tile-cta {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--ao-primary);
}

.empty-tile {
    background: #fff;
    border: 2px dashed #e5e7eb;
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    color: #64748b;
}

.activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.activity-list-item {
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
    font-size: 0.88rem;
}
.activity-list-item:last-child { border-bottom: none; }

/* ── Placeholder view (for unembedded platforms) ─────────────────────────── */

.placeholder-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 1.5rem;
}
.placeholder-icon {
    width: 80px;
    height: 80px;
    border-radius: 18px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 1.5rem;
}
.placeholder-view h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.placeholder-view .lead {
    color: #475569;
    max-width: 540px;
    margin-bottom: 1.5rem;
}
.placeholder-status {
    background: #fef3c7;
    color: #a16207;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* ── Settings views (account / billing / activity) ──────────────────────── */

.settings-view .settings-header {
    margin-bottom: 1.5rem;
}
.settings-view .settings-header h1 {
    font-size: 1.6rem;
    font-weight: 700;
}

.settings-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem;
}
.settings-card.danger {
    border-color: #fecaca;
    background: #fef2f2;
}
.settings-card h5 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.billing-total {
    margin-top: 0.5rem;
}
.billing-amount {
    font-size: 2.25rem;
    font-weight: 700;
    color: #0f172a;
}

