/* =========================================================
   META ADS PLAYBOOK — GLOBAL STYLES
========================================================= */

:root{
    --primary:#2563eb;
    --primary-dark:#1d4ed8;
    --success:#16a34a;
    --warning:#f59e0b;
    --danger:#ef4444;
    --bg:#f4f7fb;
    --card:#fff;
    --text:#111827;
    --text-light:#6b7280;
    --border:#e5e7eb;
    --radius:18px;
    --shadow:0 15px 35px rgba(0,0,0,.08);
}

*{
    margin:0;
    padding:0;
    box-sizing:border-box;
}

html{
    scroll-behavior:smooth;
}

body{
    font-family:"Inter",sans-serif;
    background:var(--bg);
    color:var(--text);
    line-height:1.8;
}


/* =========================================================
   TOPBAR
========================================================= */

.topbar{
    position:fixed;
    top:0;
    left:0;
    width:100%;
    height:70px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:0 40px;
    background:#fff;
    box-shadow:0 2px 15px rgba(0,0,0,.05);
    z-index:1000;
}

.logo{
    font-size:24px;
    font-weight:700;
    color:var(--primary);
}

.top-nav{
    display:flex;
    align-items:center;
    gap:20px;
}

.top-nav a{
    color:#444;
    text-decoration:none;
    font-weight:600;
}

.top-nav button{
    width:45px;
    height:45px;
    border:0;
    border-radius:50%;
    background:#eef3ff;
    font-size:20px;
    cursor:pointer;
}


/* =========================================================
   LAYOUT
========================================================= */

.layout{
    display:flex;
    margin-top:70px;
}


/* =========================================================
   SIDEBAR
========================================================= */

.sidebar{
    position:fixed;
    top:70px;
    left:0;
    bottom:0;
    width:260px;
    padding:25px 18px;
    background:#fff;
    border-right:1px solid var(--border);
    overflow-x:hidden;
    overflow-y:auto;
    z-index:900;
    transition:width .3s ease,padding .3s ease;
}


/* Sidebar header */

.sidebar-header{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    margin-bottom:25px;
}

.sidebar-brand{
    min-width:0;
    overflow:hidden;
    transition:opacity .2s ease,width .3s ease;
}

.sidebar-header h2{
    font-size:25px;
    line-height:1.2;
    color:var(--primary);
    white-space:nowrap;
}

.sidebar-header span{
    color:var(--text-light);
    white-space:nowrap;
}


/* Toggle */

.sidebar-toggle{
    flex-shrink:0;
    width:34px;
    height:34px;
    display:flex;
    align-items:center;
    justify-content:center;
    border:1px solid var(--border);
    border-radius:9px;
    background:#f8fafc;
    color:#475569;
    font-size:24px;
    line-height:1;
    cursor:pointer;
    transition:.25s;
}

.sidebar-toggle:hover{
    background:#eef4ff;
    color:var(--primary);
    border-color:#bfdbfe;
}


/* Search */

.sidebar-search{
    position:sticky;
    top:0;
    padding-bottom:15px;
    background:#fff;
    z-index:10;
}

.sidebar-search input{
    width:100%;
    padding:12px 13px;
    border:1px solid #d1d5db;
    border-radius:11px;
    outline:0;
    background:#fff;
    color:var(--text);
    font-family:inherit;
    font-size:13px;
    transition:.25s;
}

.sidebar-search input:focus{
    border-color:var(--primary);
    box-shadow:0 0 0 4px rgba(37,99,235,.12);
}


/* Groups */

.sidebar-group{
    margin-bottom:28px;
}

.sidebar-group h5{
    margin-bottom:12px;
    color:#9ca3af;
    font-size:11px;
    letter-spacing:1.5px;
    white-space:nowrap;
}


/* Links */

.sidebar-group a{
    display:flex;
    align-items:center;
    gap:10px;
    width:100%;
    margin-bottom:6px;
    padding:11px 10px;
    border-radius:11px;
    color:#374151;
    text-decoration:none;
    white-space:nowrap;
    transition:.25s;
}

.sidebar-group a:hover{
    background:#eef4ff;
    color:var(--primary);
}

.sidebar-group a.active{
    background:var(--primary);
    color:#fff;
}


/* Icons */

.sidebar-icon{
    width:22px;
    min-width:22px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:15px;
}

.sidebar-text{
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    transition:opacity .2s,width .3s;
}


/* =========================================================
   CONTENT
========================================================= */

.content{
    width:calc(100% - 260px);
    margin-left:260px;
    padding:50px;
    transition:margin-left .3s ease,width .3s ease;
}


/* =========================================================
   COLLAPSED SIDEBAR
========================================================= */

body.sidebar-collapsed .sidebar{
    width:78px;
    padding-left:12px;
    padding-right:12px;
}

body.sidebar-collapsed .content{
    width:calc(100% - 78px);
    margin-left:78px;
}

body.sidebar-collapsed .sidebar-brand{
    width:0;
    opacity:0;
}

body.sidebar-collapsed .sidebar-header{
    justify-content:center;
}

body.sidebar-collapsed .sidebar-toggle{
    transform:rotate(180deg);
}

body.sidebar-collapsed .sidebar-search input{
    padding-left:0;
    padding-right:0;
    text-align:center;
    font-size:0;
}

body.sidebar-collapsed .sidebar-search input::placeholder{
    font-size:0;
}

body.sidebar-collapsed .sidebar-group h5{
    height:8px;
    margin-bottom:8px;
    font-size:0;
}

body.sidebar-collapsed .sidebar-group a{
    justify-content:center;
    gap:0;
    padding-left:8px;
    padding-right:8px;
}

body.sidebar-collapsed .sidebar-text{
    display:none;
}

body.sidebar-collapsed .sidebar-icon{
    margin:0;
}


/* =========================================================
   HERO
========================================================= */

.hero{
    position:relative;
    overflow:hidden;
    margin-bottom:40px;
    padding:70px;
    border-radius:30px;
    background:linear-gradient(135deg,#2563eb,#4f46e5);
    color:#fff;
}

.hero::after{
    content:"";
    position:absolute;
    top:-150px;
    right:-150px;
    width:400px;
    height:400px;
    border-radius:50%;
    background:rgba(255,255,255,.08);
}

.chapter{
    display:inline-block;
    margin-bottom:20px;
    padding:8px 15px;
    border-radius:40px;
    background:rgba(255,255,255,.18);
}

.hero h1{
    margin-bottom:20px;
    font-family:"Poppins",sans-serif;
    font-size:54px;
    line-height:1.2;
}

.hero p{
    max-width:700px;
    font-size:18px;
    opacity:.95;
}

.hero-stats{
    display:flex;
    gap:20px;
    margin-top:45px;
}

.stat{
    min-width:170px;
    padding:20px;
    border-radius:18px;
    background:rgba(255,255,255,.12);
}

.stat strong{
    display:block;
    font-size:28px;
}

.stat span{
    font-size:14px;
}


/* =========================================================
   CARDS
========================================================= */

.card{
    margin-bottom:30px;
    padding:40px;
    border-radius:20px;
    background:#fff;
    box-shadow:var(--shadow);
}

.card h2{
    margin-bottom:20px;
    font-size:34px;
}

.card p{
    margin-bottom:18px;
}


/* =========================================================
   CHECKLIST
========================================================= */

.check-list{
    list-style:none;
}

.check-list li{
    padding:10px 0;
    font-size:18px;
}


/* =========================================================
   FLOW
========================================================= */

.flow{
    display:flex;
    flex-direction:column;
    align-items:center;
}

.box{
    min-width:260px;
    padding:18px 30px;
    border-radius:15px;
    background:#eef4ff;
    text-align:center;
    font-weight:700;
}

.box.success{
    background:#dcfce7;
    color:#166534;
}

.arrow{
    margin:10px 0;
    font-size:34px;
}


/* =========================================================
   HIERARCHY
========================================================= */

.hierarchy{
    display:flex;
    flex-direction:column;
    align-items:center;
    margin:40px 0;
}

.level{
    width:260px;
    padding:18px 40px;
    border-radius:12px;
    background:var(--primary);
    color:#fff;
    text-align:center;
    font-weight:700;
}

.hierarchy span{
    margin:15px;
    font-size:32px;
}


/* =========================================================
   TIP
========================================================= */

.tip{
    margin-bottom:30px;
    padding:35px;
    border-left:6px solid var(--success);
    border-radius:18px;
    background:#ecfdf5;
}

.tip h3{
    margin-bottom:15px;
}


/* =========================================================
   WARNING
========================================================= */

.warning{
    margin-bottom:30px;
    padding:35px;
    border-left:6px solid var(--warning);
    border-radius:18px;
    background:#fff7ed;
}


/* =========================================================
   BUTTONS
========================================================= */

.chapter-nav{
    display:flex;
    justify-content:space-between;
    gap:15px;
    margin-top:50px;
}

.btn{
    display:inline-block;
    padding:16px 32px;
    border-radius:14px;
    background:var(--primary);
    color:#fff;
    text-decoration:none;
    transition:.25s;
}

.btn:hover{
    background:var(--primary-dark);
    transform:translateY(-2px);
}

.btn.disabled{
    opacity:.5;
    pointer-events:none;
}


/* =========================================================
   LEARNING GRID
========================================================= */

.learning-grid{
    display:grid;
    grid-template-columns:repeat(2,1fr);
    gap:25px;
    margin:40px 0;
}

.learn-card{
    padding:35px;
    border-radius:18px;
    background:#fff;
    color:#000;
    box-shadow:0 15px 40px rgba(0,0,0,.08);
    transition:.35s;
}

.learn-card:hover{
    transform:translateY(-8px);
}

.learn-card h3{
    margin-bottom:15px;
}


/* =========================================================
   COMPARISON TABLE
========================================================= */

.table-wrapper{
    width:100%;
    margin-top:25px;
    overflow-x:auto;
}

.comparison-table{
    width:100%;
    min-width:700px;
    border-collapse:collapse;
    overflow:hidden;
    border-radius:14px;
    background:#fff;
}

.comparison-table th{
    padding:18px;
    background:var(--primary);
    color:#fff;
    text-align:left;
    font-size:15px;
}

.comparison-table td{
    padding:18px;
    border-bottom:1px solid var(--border);
    font-size:15px;
}

.comparison-table tbody tr:last-child td{
    border-bottom:0;
}

.comparison-table tbody tr:hover{
    background:#f8fafc;
}


/* =========================================================
   ANIMATION
========================================================= */

.card,
.hero,
.tip,
.warning{
    animation:fadeUp .6s ease;
}

@keyframes fadeUp{
    from{
        opacity:0;
        transform:translateY(25px);
    }
    to{
        opacity:1;
        transform:translateY(0);
    }
}


/* =========================================================
   SCROLL REVEAL
========================================================= */

.card,
.tip,
.warning{
    opacity:0;
    transform:translateY(40px);
    transition:opacity 1s,transform 1s;
}

.card.show,
.tip.show,
.warning.show{
    opacity:1;
    transform:translateY(0);
}


/* =========================================================
   READING PROGRESS
========================================================= */

#progressBar{
    position:fixed;
    top:0;
    left:0;
    width:0;
    height:4px;
    background:linear-gradient(90deg,#2563eb,#4f46e5);
    z-index:99999;
}


/* =========================================================
   BACK TO TOP
========================================================= */

#backTop{
    position:fixed;
    right:35px;
    bottom:35px;
    width:52px;
    height:52px;
    border:0;
    border-radius:50%;
    background:var(--primary);
    color:#fff;
    font-size:22px;
    cursor:pointer;
    opacity:0;
    transform:translateY(20px);
    transition:.3s;
    box-shadow:0 15px 30px rgba(0,0,0,.2);
}

#backTop.show{
    opacity:1;
    transform:translateY(0);
}


/* =========================================================
   DARK MODE
========================================================= */

body.dark{
    --bg:#0f172a;
    --card:#1e293b;
    --text:#f8fafc;
    --text-light:#cbd5e1;
    --border:#334155;
    background:var(--bg);
    color:var(--text);
}

body.dark .topbar,
body.dark .sidebar,
body.dark .card,
body.dark .learn-card,
body.dark .sidebar-search{
    background:#1e293b;
}

body.dark .sidebar-group a{
    color:#d1d5db;
}

body.dark .sidebar-toggle{
    background:#263449;
    border-color:#334155;
    color:#cbd5e1;
}

body.dark .sidebar-search input{
    background:#0f172a;
    border-color:#334155;
    color:#fff;
}

body.dark .tip{
    background:#064e3b;
}

body.dark .warning{
    background:#78350f;
}

body.dark .comparison-table{
    background:#1e293b;
}

body.dark .comparison-table td{
    border-color:#334155;
}

body.dark .comparison-table tbody tr:hover{
    background:#263449;
}


/* =========================================================
   TABLET
========================================================= */

@media(max-width:1100px){

    .sidebar{
        width:230px;
        padding:22px 15px;
    }

    .content{
        width:calc(100% - 230px);
        margin-left:230px;
        padding:35px;
    }

    body.sidebar-collapsed .sidebar{
        width:70px;
    }

    body.sidebar-collapsed .content{
        width:calc(100% - 70px);
        margin-left:70px;
    }

    .sidebar-header h2{
        font-size:23px;
    }

    .sidebar-group a{
        font-size:13px;
    }

    .hero{
        padding:50px 40px;
    }

    .hero h1{
        font-size:44px;
    }
}


/* =========================================================
   MOBILE
========================================================= */

@media(max-width:600px){

    .topbar{
        height:60px;
        padding:0 15px;
    }

    .layout{
        margin-top:60px;
    }

    /*
    Mobile sidebar starts collapsed
    */

    .sidebar{
        top:60px;
        width:68px;
        padding:15px 8px;
    }

    .content{
        width:calc(100% - 68px);
        margin-left:68px;
        padding:15px 10px;
    }

    /*
    Expanded mobile sidebar
    */

    body:not(.sidebar-collapsed) .sidebar{
        width:230px;
        padding:18px 14px;
        box-shadow:10px 0 30px rgba(15,23,42,.12);
    }

    body:not(.sidebar-collapsed) .content{
        width:calc(100% - 230px);
        margin-left:230px;
    }

    .sidebar-brand{
        display:none;
    }

    .sidebar-header{
        justify-content:center;
        margin-bottom:15px;
    }

    .sidebar-toggle{
        width:36px;
        height:36px;
    }

    .sidebar-search{
        padding-bottom:10px;
    }

    .sidebar-search input{
        padding:9px 0;
        font-size:0;
        text-align:center;
    }

    .sidebar-search input::placeholder{
        font-size:0;
    }

    .sidebar-group h5{
        height:7px;
        margin-bottom:8px;
        font-size:0;
    }

    .sidebar-group a{
        justify-content:center;
        gap:0;
        padding:8px 5px;
        margin-bottom:4px;
        border-radius:8px;
        font-size:10px;
    }

    .sidebar-text{
        display:none;
    }

    /*
    Expanded mobile state
    */

    body:not(.sidebar-collapsed) .sidebar-brand{
        display:block;
        width:auto;
        opacity:1;
    }

    body:not(.sidebar-collapsed) .sidebar-header{
        justify-content:space-between;
    }

    body:not(.sidebar-collapsed) .sidebar-search input{
        padding:10px 11px;
        font-size:12px;
        text-align:left;
    }

    body:not(.sidebar-collapsed) .sidebar-search input::placeholder{
        font-size:12px;
    }

    body:not(.sidebar-collapsed) .sidebar-group h5{
        height:auto;
        margin-bottom:9px;
        font-size:10px;
    }

    body:not(.sidebar-collapsed) .sidebar-group a{
        justify-content:flex-start;
        gap:9px;
        padding:9px 8px;
        font-size:11px;
    }

    body:not(.sidebar-collapsed) .sidebar-text{
        display:block;
        width:auto;
        opacity:1;
    }

    .hero{
        padding:25px 18px;
        border-radius:18px;
    }

    .hero h1{
        font-size:27px;
        line-height:1.25;
    }

    .hero p{
        font-size:14px;
    }

    .hero-stats{
        flex-direction:column;
        gap:10px;
        margin-top:25px;
    }

    .stat{
        min-width:0;
        padding:15px;
    }

    .card{
        padding:18px 15px;
        border-radius:15px;
    }

    .card h2{
        font-size:21px;
    }

    .card p{
        font-size:14px;
    }

    .check-list li{
        font-size:15px;
    }

    .learning-grid{
        grid-template-columns:1fr;
        gap:15px;
        margin:25px 0;
    }

    .learn-card{
        padding:22px;
    }

    .tip,
    .warning{
        padding:20px;
    }

    .chapter-nav{
        flex-direction:column;
        gap:12px;
        margin-top:30px;
    }

    .btn{
        width:100%;
        padding:13px 20px;
        text-align:center;
    }

    #backTop{
        right:15px;
        bottom:15px;
        width:45px;
        height:45px;
    }
}


/* =========================================================
   SMALL MOBILE
========================================================= */

@media(max-width:400px){

    .sidebar{
        width:62px;
    }

    .content{
        width:calc(100% - 62px);
        margin-left:62px;
        padding:12px 8px;
    }

    body:not(.sidebar-collapsed) .sidebar{
        width:220px;
    }

    body:not(.sidebar-collapsed) .content{
        width:calc(100% - 220px);
        margin-left:220px;
    }

    .hero{
        padding:22px 15px;
    }

    .hero h1{
        font-size:24px;
    }

    .card{
        padding:15px 12px;
    }
}