/* ============================================================
   PushNotify Dashboard - Main Layout Styles
   ============================================================ */

/* ---- Reset & Base ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--pn-font-primary);
    background: var(--pn-bg-primary);
    color: var(--pn-text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

a {
    color: var(--pn-accent-light);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ---- App Layout ---- */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* ---- Sidebar ---- */
.sidebar {
    width: var(--pn-sidebar-width);
    background: var(--pn-bg-sidebar);
    border-right: 1px solid var(--pn-border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: var(--pn-transition-slow);
}

.sidebar-logo {
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--pn-border);
}

.sidebar-logo__icon {
    width: 36px;
    height: 36px;
    background: var(--pn-gradient);
    border-radius: var(--pn-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-logo__text {
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: var(--pn-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.sidebar-section {
    margin-bottom: 24px;
}

.sidebar-section__title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--pn-text-dim);
    padding: 0 12px;
    margin-bottom: 8px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--pn-radius-md);
    color: var(--pn-text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: var(--pn-transition);
    cursor: pointer;
    text-decoration: none;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--pn-text-primary);
    text-decoration: none;
}

.sidebar-link.active {
    background: var(--pn-accent-glow);
    color: var(--pn-accent-light);
}

.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--pn-gradient);
    border-radius: 0 4px 4px 0;
}

.sidebar-link__icon {
    width: 20px;
    height: 20px;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-link__badge {
    margin-left: auto;
    background: var(--pn-accent);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: var(--pn-radius-full);
    min-width: 20px;
    text-align: center;
}

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

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--pn-radius-md);
    cursor: pointer;
    transition: var(--pn-transition);
}

.sidebar-user:hover {
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-user__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--pn-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}

.sidebar-user__name {
    font-size: 14px;
    font-weight: 600;
    color: var(--pn-text-primary);
}

.sidebar-user__role {
    font-size: 12px;
    color: var(--pn-text-muted);
}

/* ---- Main Content ---- */
.main-content {
    flex: 1;
    margin-left: var(--pn-sidebar-width);
    min-height: 100vh;
}

/* ---- Top Header ---- */
.top-header {
    position: sticky;
    top: 0;
    height: var(--pn-header-height);
    background: rgba(15, 15, 26, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--pn-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    z-index: 50;
}

.top-header__left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.top-header__title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.top-header__breadcrumb {
    font-size: 13px;
    color: var(--pn-text-muted);
}

.top-header__right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--pn-text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

/* ---- Site Selector ---- */
.site-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--pn-border);
    border-radius: var(--pn-radius-full);
    cursor: pointer;
    transition: var(--pn-transition);
    font-size: 13px;
    color: var(--pn-text-secondary);
}

.site-selector:hover {
    border-color: var(--pn-accent);
}

.site-selector__dot {
    width: 8px;
    height: 8px;
    background: var(--pn-success);
    border-radius: 50%;
}

.site-selector-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    width: 240px;
    background: var(--pn-bg-card);
    border: 1px solid var(--pn-border);
    border-radius: var(--pn-radius-md);
    box-shadow: var(--pn-shadow-lg);
    display: none;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
}

.site-selector-dropdown.active {
    display: flex;
    animation: fadeInDown 0.2s ease;
}

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.site-selector-list {
    max-height: 250px;
    overflow-y: auto;
    padding: 6px;
}

.site-selector-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--pn-radius-sm);
    color: var(--pn-text-secondary);
    font-size: 13px;
    transition: var(--pn-transition);
}

.site-selector-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--pn-text-primary);
}

.site-selector-item.active {
    color: var(--pn-accent-light);
    font-weight: 600;
}

.site-selector-footer {
    padding: 8px;
    border-top: 1px solid var(--pn-border);
    background: rgba(255, 255, 255, 0.02);
}

.btn-text {
    background: none;
    border: none;
    color: var(--pn-accent-light);
    font-size: 13px;
    font-weight: 500;
    padding: 8px;
    cursor: pointer;
    text-align: center;
    border-radius: var(--pn-radius-sm);
    transition: var(--pn-transition);
}

.btn-text:hover {
    background: var(--pn-accent-glow);
}

/* ---- Page Content ---- */
.page-content {
    padding: 28px 32px 40px;
}

.page-title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.page-subtitle {
    font-size: 14px;
    color: var(--pn-text-muted);
    margin-bottom: 28px;
}

/* ---- Grid Layouts ---- */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 28px;
}

/* ---- Chart Container ---- */
.chart-container {
    position: relative;
    height: 280px;
    width: 100%;
}

/* ---- Notification Preview ---- */
.notif-preview {
    background: #2d2d3f;
    border-radius: var(--pn-radius-lg);
    padding: 16px;
    display: flex;
    gap: 12px;
    max-width: 380px;
    border: 1px solid var(--pn-border-light);
    box-shadow: var(--pn-shadow-md);
}

.notif-preview__icon {
    width: 48px;
    height: 48px;
    border-radius: var(--pn-radius-md);
    background: var(--pn-accent-glow);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 24px;
}

.notif-preview__title {
    font-size: 14px;
    font-weight: 700;
    color: var(--pn-text-primary);
    margin-bottom: 4px;
}

.notif-preview__body {
    font-size: 13px;
    color: var(--pn-text-secondary);
    line-height: 1.5;
}

.notif-preview__domain {
    font-size: 11px;
    color: var(--pn-text-dim);
    margin-top: 6px;
}

/* ---- Search Bar ---- */
.search-bar {
    position: relative;
}

.search-bar__icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--pn-text-dim);
    font-size: 16px;
}

.search-bar__input {
    width: 100%;
    padding: 10px 14px 10px 42px;
    background: var(--pn-bg-input);
    border: 1px solid var(--pn-border);
    border-radius: var(--pn-radius-full);
    color: var(--pn-text-primary);
    font-size: 14px;
    outline: none;
    transition: var(--pn-transition);
}

.search-bar__input:focus {
    border-color: var(--pn-accent);
    box-shadow: 0 0 0 3px var(--pn-accent-glow);
}

/* ---- Login Page ---- */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pn-bg-primary);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08), transparent 70%);
    top: -100px;
    right: -100px;
    border-radius: 50%;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.06), transparent 70%);
    bottom: -100px;
    left: -100px;
    border-radius: 50%;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--pn-bg-card);
    border: 1px solid var(--pn-border-light);
    border-radius: var(--pn-radius-xl);
    padding: 40px;
    box-shadow: var(--pn-shadow-lg);
    position: relative;
    z-index: 1;
}

.login-card__logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-card__title {
    font-size: 22px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
}

.login-card__subtitle {
    text-align: center;
    font-size: 14px;
    color: var(--pn-text-muted);
    margin-bottom: 32px;
}

.login-error {
    background: var(--pn-danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--pn-radius-md);
    padding: 12px 16px;
    font-size: 13px;
    color: var(--pn-danger);
    margin-bottom: 20px;
    display: none;
}

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

.section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--pn-text-primary);
}

/* ---- Flex Utilities ---- */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.w-full { width: 100%; }

/* ---- View Containers (SPA pages) ---- */
.view {
    display: none;
}

.view.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* ---- Tabs ---- */
.tabs {
    display: flex;
    gap: 12px;
    border-bottom: 1px solid var(--pn-border);
    padding-bottom: 2px;
}

.tab-btn {
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--pn-text-secondary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: var(--pn-text-primary);
}

.tab-btn.active {
    color: var(--pn-accent-light);
    border-bottom-color: var(--pn-accent);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}
