/* ===============================
   PCNS Layout CSS
   Desktop + Mobile Responsive
================================ */

/* Root Theme Variables */
:root {
    --primary-color: #0b5ed7;
    --primary-dark: #063b8f;
    --secondary-color: #00b4d8;

    --body-bg: #f5f7fb;
    --card-bg: #ffffff;
    --header-bg: rgba(255, 255, 255, 0.92);
    --sidebar-bg: #ffffff;

    --text-color: #1f2937;
    --muted-color: #6b7280;
    --border-color: rgba(15, 23, 42, 0.1);

    --shadow-sm: 0 8px 24px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 16px 40px rgba(15, 23, 42, 0.14);

    --header-height: 74px;
    --sidebar-width: 310px;

    --transition-fast: 0.25s ease;
    --transition-normal: 0.35s ease;
}

/* Dark Theme */
html[data-theme="dark"] {
    --body-bg: #07111f;
    --card-bg: #0f1b2d;
    --header-bg: rgba(10, 20, 35, 0.92);
    --sidebar-bg: #0f1b2d;

    --text-color: #f3f7ff;
    --muted-color: #a7b3c8;
    --border-color: rgba(255, 255, 255, 0.1);

    --shadow-sm: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.45);
}

/* General Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background: var(--body-bg);
    color: var(--text-color);
    font-family: "Inter", "Segoe UI", Arial, sans-serif;
    overflow-x: hidden;
    transition: background var(--transition-normal), color var(--transition-normal);
}

a {
    text-decoration: none;
}

button,
input {
    font-family: inherit;
}

button {
    border: none;
    outline: none;
}

/* ===============================
   Loader
================================ */

.app-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background:
        radial-gradient(circle at top, rgba(11, 94, 215, 0.14), transparent 35%),
        var(--body-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.45s ease, visibility 0.45s ease;
}

.app-loader.hide-loader {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-box {
    text-align: center;
    position: relative;
    animation: loaderPop 0.7s ease forwards;
}

.loader-logo {
    width: 120px;
    max-width: 70vw;
    height: auto;
    object-fit: contain;
    margin-bottom: 24px;
    animation: logoPulse 1.5s infinite ease-in-out;
}

.loader-ring {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    border: 4px solid rgba(11, 94, 215, 0.15);
    border-top-color: var(--primary-color);
    margin: 0 auto 14px;
    animation: spin 0.9s linear infinite;
}

.loader-box p {
    color: var(--muted-color);
    font-size: 14px;
    letter-spacing: 0.04em;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes logoPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.9;
    }

    50% {
        transform: scale(1.05);
        opacity: 1;
    }
}

@keyframes loaderPop {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===============================
   Header
================================ */

.app-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    height: var(--header-height);
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--header-bg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 36px;
    transition: background var(--transition-normal), border var(--transition-normal);
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: 18px;
}

.header-brand {
    display: inline-flex;
    align-items: center;
}

.header-logo {
    height: 48px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
}

/* Menu Button */
.menu-btn {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: transform var(--transition-fast), background var(--transition-fast);
}

.menu-btn span {
    width: 21px;
    height: 2px;
    border-radius: 99px;
    background: var(--text-color);
    transition: var(--transition-fast);
}

.menu-btn:hover {
    transform: translateY(-2px);
    background: rgba(11, 94, 215, 0.08);
}

/* Desktop Search */
.desktop-search {
    width: 440px;
    height: 48px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    display: flex;
    align-items: center;
    padding: 0 6px 0 18px;
    gap: 10px;
    box-shadow: var(--shadow-sm);
    transition: border var(--transition-fast), box-shadow var(--transition-fast);
}

.desktop-search:focus-within {
    border-color: rgba(11, 94, 215, 0.55);
    box-shadow: 0 0 0 4px rgba(11, 94, 215, 0.12);
}

.desktop-search i {
    color: var(--muted-color);
    font-size: 18px;
}

.desktop-search input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-color);
    font-size: 15px;
}

.desktop-search input::placeholder {
    color: var(--muted-color);
}

.desktop-search button {
    height: 38px;
    padding: 0 20px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.desktop-search button:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(11, 94, 215, 0.25);
}

/* Theme Toggle */
.theme-toggle-btn,
.mobile-search-btn {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--card-bg);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform var(--transition-fast), background var(--transition-fast);
}

.theme-toggle-btn:hover,
.mobile-search-btn:hover {
    transform: translateY(-2px);
    background: rgba(11, 94, 215, 0.08);
}

.theme-toggle-btn i,
.mobile-search-btn i {
    font-size: 19px;
}

html[data-theme="light"] .theme-toggle-btn .light-icon {
    display: none;
}

html[data-theme="dark"] .theme-toggle-btn .dark-icon {
    display: none;
}

.mobile-search-btn {
    display: none;
}

/* ===============================
   Sidebar
================================ */

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 1400;
    background: rgba(0, 0, 0, 0.48);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.app-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1500;
    width: var(--sidebar-width);
    max-width: 86vw;
    height: 100vh;
    height: 100dvh;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    transform: translateX(-105%);
    transition: transform var(--transition-normal), background var(--transition-normal);
    display: flex;
    flex-direction: column;
}

.app-sidebar.active {
    transform: translateX(0);
}

.sidebar-header {
    height: var(--header-height);
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    height: 46px;
    width: auto;
    max-width: 170px;
    object-fit: contain;
}

.sidebar-close-btn {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: rgba(11, 94, 215, 0.08);
    color: var(--text-color);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.sidebar-close-btn:hover {
    background: rgba(220, 38, 38, 0.12);
    color: #dc2626;
    transform: rotate(90deg);
}

.sidebar-nav {
    flex: 1;
    padding: 18px 14px;
    overflow-y: auto;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(100, 116, 139, 0.45);
    border-radius: 999px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 13px;
    padding: 13px 15px;
    margin-bottom: 8px;
    color: var(--muted-color);
    border-radius: 15px;
    font-size: 15px;
    font-weight: 600;
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.sidebar-link i {
    width: 23px;
    font-size: 18px;
}

.sidebar-link:hover,
.sidebar-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    transform: translateX(4px);
}

.sidebar-footer {
    padding: 18px;
    border-top: 1px solid var(--border-color);
}

.sidebar-footer p {
    color: var(--muted-color);
    font-size: 14px;
    margin-bottom: 10px;
}

.sidebar-call-btn {
    width: 100%;
    height: 44px;
    border-radius: 14px;
    background: rgba(11, 94, 215, 0.1);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    font-weight: 700;
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.sidebar-call-btn:hover {
    background: var(--primary-color);
    color: #ffffff;
    transform: translateY(-2px);
}

/* ===============================
   Mobile Search
================================ */

.mobile-search-panel {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    z-index: 990;
    background: var(--header-bg);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 18px;
    transform: translateY(-120%);
    opacity: 0;
    visibility: hidden;
    transition: transform var(--transition-normal), opacity var(--transition-normal), visibility var(--transition-normal);
}

.mobile-search-panel.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.mobile-search-form {
    width: 100%;
    height: 48px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 0 16px;
}

.mobile-search-form i {
    color: var(--muted-color);
}

.mobile-search-form input {
    flex: 1;
    min-width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-color);
    font-size: 14px;
}

.mobile-search-form button[type="submit"] {
    height: 36px;
    padding: 0 15px;
    border-radius: 999px;
    background: var(--primary-color);
    color: #ffffff;
    font-weight: 600;
}

.mobile-search-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(220, 38, 38, 0.1);
    color: #dc2626;
}

/* ===============================
   Main Content + Footer
================================ */

.app-main {
    flex: 1;
    width: 100%;
    min-height: calc(100vh - var(--header-height));
}

.app-footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 22px 0;
    text-align: center;
    color: var(--muted-color);
    font-size: 14px;
}

/* ===============================
   Responsive
================================ */

@media (max-width: 1199px) {
    .desktop-search {
        width: 340px;
    }
}

@media (max-width: 991px) {
    .app-header {
        padding: 0 22px;
    }

    .desktop-search {
        display: none;
    }

    .mobile-search-btn {
        display: inline-flex;
    }

    .header-logo {
        height: 44px;
        max-width: 150px;
    }
}

@media (max-width: 575px) {
    :root {
        --header-height: 68px;
        --sidebar-width: 292px;
    }

    .app-header {
        padding: 0 14px;
    }

    .header-left,
    .header-right {
        gap: 10px;
    }

    .menu-btn,
    .theme-toggle-btn,
    .mobile-search-btn {
        width: 42px;
        height: 42px;
        border-radius: 13px;
    }

    .menu-btn span {
        width: 19px;
    }

    .header-logo {
        height: 39px;
        max-width: 135px;
    }

    .sidebar-logo {
        height: 40px;
        max-width: 145px;
    }

    .sidebar-header {
        padding: 0 16px;
    }

    .sidebar-link {
        font-size: 14px;
        padding: 12px 14px;
    }

    .mobile-search-panel {
        padding: 12px;
    }

    .loader-logo {
        width: 100px;
    }
}
.app-footer a {
    color: var(--muted-color) !important;
    font-weight: 700;
    transition: color 0.25s ease;
}

.app-footer a:hover {
    color: var(--primary-color) !important;
}