/* ============================================================================
   PrimexaTools - main stylesheet
   Same identity (red / near-black, uppercase accents, boxy cards).
   Refined type scale, one consistent radius + shadow scale, defined focus
   states, and every class the templates actually use.
   ========================================================================== */

/* ---------------------------------------------------------------- 1. TOKENS */
:root {
    --primary: #e60000;
    --primary-dark: #c00000;
    --primary-soft: #fdeceb;

    --dark: #17181c;
    --nav-bg: #17181c;

    --text: #2b2d31;
    --gray: #666a70;
    --muted: #8b9096;

    --light: #f4f5f7;
    --white: #fff;

    --border: #e4e6e9;
    --border-strong: #d2d5da;

    /* restrained elevation - no heavy drop shadows */
    --shadow-xs: 0 1px 2px rgba(16, 18, 22, .06);
    --shadow: 0 1px 3px rgba(16, 18, 22, .08), 0 1px 2px rgba(16, 18, 22, .04);
    --shadow-md: 0 8px 20px -8px rgba(16, 18, 22, .22);

    --radius: 10px;
    --radius-sm: 6px;
    --radius-xs: 4px;
    --pill: 999px;

    --t: 160ms cubic-bezier(.4, 0, .2, 1);
    --maxw: 1200px;
}

/* ---------------------------------------------------------------- 2. RESET */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
    background: var(--light);
    color: var(--text);
    line-height: 1.65;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; }

h1, h2, h3, h4 { line-height: 1.3; color: var(--dark); }

.container {
    width: 92%;
    max-width: var(--maxw);
    margin: 0 auto;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--t);
}

a:hover { text-decoration: underline; }

/* One visible, consistent keyboard focus ring everywhere */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}

/* ------------------------------------------------------------ 3. TOP BAR */
.top-bar {
    background: var(--light);
    border-bottom: 1px solid var(--border);
    padding: 6px 0;
    font-size: 13px;
}

.top-bar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.top-links a {
    color: var(--gray);
    margin-right: 16px;
    font-weight: 500;
}

.top-links a:hover { color: var(--primary); text-decoration: none; }

.top-social a {
    display: inline-grid;
    place-items: center;
    width: 26px;
    height: 26px;
    background: var(--dark);
    color: #fff;
    border-radius: var(--pill);
    margin-left: 6px;
    font-size: 12px;
    transition: background var(--t), transform var(--t);
}

.top-social a:hover {
    background: var(--primary);
    text-decoration: none;
    transform: translateY(-1px);
}

/* Language selector - was completely unstyled before */
.lang-switch select {
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    cursor: pointer;
    transition: border-color var(--t);
}

.lang-switch select:hover { border-color: var(--border-strong); }

/* ------------------------------------------------------------- 4. HEADER */
.site-header {
    background: var(--white);
    padding: 18px 0;
}

.header-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.logo-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none !important;
}

.logo-box {
    background: linear-gradient(135deg, #e31e24, #b31419);
    color: #fff;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 900;
    font-size: 1.6rem;
    border-radius: var(--radius);
    box-shadow: 0 4px 10px -4px rgba(227, 30, 36, .55);
}

.logo-text {
    line-height: 1;
    display: flex;
    flex-direction: column;
}

.logo-main {
    color: var(--dark);
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: -1.5px;
    text-transform: uppercase;
}

.logo-sub {
    color: #e31e24;
    font-size: .9rem;
    font-weight: 800;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-top: 2px;
}

.header-search {
    display: flex;
    max-width: 340px;
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color var(--t), box-shadow var(--t);
}

.header-search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230, 0, 0, .12);
}

.header-search input {
    flex: 1;
    min-width: 0;
    padding: 10px 14px;
    border: 0;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    background: transparent;
}

.header-search button {
    padding: 10px 18px;
    background: var(--primary);
    color: #fff;
    border: 0;
    cursor: pointer;
    font-weight: 600;
    font-family: inherit;
    font-size: 14px;
    transition: background var(--t);
}

.header-search button:hover { background: var(--primary-dark); }

/* --------------------------------------------------------------- 5. NAV */
.main-nav {
    background: var(--nav-bg);
    border-top: 3px solid var(--primary);
    box-shadow: 0 1px 0 rgba(0, 0, 0, .08);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-inner {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    scrollbar-width: none;      /* cleaner horizontal scroll on mobile */
}

.nav-inner::-webkit-scrollbar { display: none; }

.nav-inner a,
.dropbtn {
    color: #fff;
    padding: 14px 16px;
    display: block;
    font-weight: 600;
    font-size: 14px;
    font-family: inherit;
    text-transform: uppercase;
    letter-spacing: .3px;
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    background: none;
    border: 0;
    cursor: pointer;
    transition: background var(--t), color var(--t);
}

.nav-inner a:hover,
.dropbtn:hover {
    background: var(--primary);
    color: #fff;
    text-decoration: none;
}

.nav-home {
    background: var(--primary);
    padding: 14px 18px !important;
}

.nav-home:hover { background: var(--primary-dark) !important; }

.nav-dropdown {
    position: relative;
    flex-shrink: 0;
}

.nav-dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--dark);
    min-width: 240px;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    box-shadow: 0 10px 24px -8px rgba(0, 0, 0, .45);
    z-index: 9999;
    padding: 5px 0;
}

.nav-dropdown-content a {
    display: block !important;
    width: 100%;
    padding: 10px 16px !important;
    border-bottom: 1px solid #2b2d31;
    text-transform: none !important;
    font-weight: 500 !important;
    letter-spacing: 0 !important;
    font-size: 14px !important;
    color: #fff !important;
}

.nav-dropdown-content a:last-child { border-bottom: 0; }

.nav-dropdown-content a:hover { background: var(--primary) !important; }

.nav-dropdown:hover .nav-dropdown-content,
.nav-dropdown:focus-within .nav-dropdown-content { display: block; }

/* ------------------------------------------------------------- 6. LAYOUT */
.main-content { padding: 25px 0; }

.page-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 25px;
    align-items: start;
}

/* min-width:0 stops long descriptions from blowing out the grid column */
.main-col { min-width: 0; }

/* --------------------------------------------------- 7. SECTION HEADINGS */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: var(--white);
    padding: 12px 16px;
    border-left: 4px solid var(--primary);
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    box-shadow: var(--shadow-xs);
}

.section-header h2 {
    margin: 0;
    font-size: 18px;
    letter-spacing: .2px;
    text-transform: uppercase;
}

.view-all {
    background: var(--primary);
    color: #fff;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .4px;
    border-radius: var(--radius-xs);
    text-decoration: none;
    white-space: nowrap;
    transition: background var(--t);
}

.view-all:hover { background: var(--primary-dark); text-decoration: none; }

/* -------------------------------------------------------------- 8. CARDS */
.app-list {
    display: flex;
    flex-direction: column;
}

.post-card {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 18px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--t), border-color var(--t), transform var(--t);
}

.post-card:hover {
    border-color: var(--border-strong);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.post-thumb {
    width: 260px;
    height: 160px;
    background: var(--light);
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    overflow: hidden;
    color: var(--primary);
    font-size: 60px;
    font-weight: 700;
}

.post-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 300ms cubic-bezier(.4, 0, .2, 1);
}

.post-card:hover .post-thumb img { transform: scale(1.04); }

.post-body {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.post-category {
    display: inline-block;
    background: var(--primary-soft);
    color: var(--primary-dark);
    padding: 3px 10px;
    border-radius: var(--radius-xs);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    width: fit-content;
    margin-bottom: 8px;
}

.post-title {
    margin: 0 0 8px;
    font-size: 20px;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.post-title a { color: var(--dark); }

.post-title a:hover { color: var(--primary); text-decoration: none; }

.post-meta {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 10px;
}

.post-meta span { margin-right: 12px; }
.post-meta .fas, .post-meta .far { color: var(--muted); }

.post-excerpt {
    color: var(--gray);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
    flex: 1;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.placeholder-icon {
    display: grid;
    place-items: center;
    background: var(--light);
    border-radius: var(--radius-sm);
    color: var(--primary);
    font-weight: 800;
    font-size: 24px;
}

/* ------------------------------------------------------------ 9. BUTTONS */
.btn-red {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 8px 18px;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: .3px;
    text-transform: uppercase;
    border: 0;
    border-radius: var(--radius-sm);
    width: fit-content;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    transition: background var(--t), transform var(--t), box-shadow var(--t);
}

.btn-red:hover {
    background: var(--primary-dark);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px -4px rgba(192, 0, 0, .55);
}

.btn-red:active { transform: translateY(0); }

.btn-lg { padding: 14px 28px; font-size: 16px; }

/* Admin buttons: .btn is the markup, .admin-btn kept as an alias */
.btn,
.admin-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: .62rem 1.25rem;
    border: 1px solid transparent;
    background: var(--primary);
    color: #fff;
    font-family: inherit;
    font-weight: 700;
    font-size: .88rem;
    cursor: pointer;
    border-radius: var(--radius-sm);
    text-decoration: none;
    line-height: 1.2;
    transition: background var(--t), transform var(--t), border-color var(--t);
}

.btn:hover,
.admin-btn:hover {
    background: var(--primary-dark);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}

.btn:active,
.admin-btn:active { transform: translateY(0); }

.btn-secondary,
.admin-btn-secondary {
    background: var(--white);
    color: #4a5058;
    border-color: var(--border-strong);
}

.btn-secondary:hover,
.admin-btn-secondary:hover {
    background: #f1f3f5;
    color: var(--dark);
    border-color: #b9bec5;
}

.btn-danger,
.admin-btn-danger {
    background: #dc2626;
    color: #fff;
}

.btn-danger:hover,
.admin-btn-danger:hover { background: #b91c1c; color: #fff; }

.btn-sm,
.admin-btn-sm {
    padding: .34rem .7rem;
    font-size: .76rem;
}

.btn[disabled],
.btn:disabled,
.admin-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none;
}

/* ------------------------------------------------------------ 10. SIDEBAR */
.sidebar { min-width: 0; }

.widget {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}

.widget-title {
    background: var(--dark);
    color: #fff;
    padding: 12px 16px;
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
}

.widget-content { padding: 16px; }

.widget-search form {
    display: flex;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: border-color var(--t), box-shadow var(--t);
}

.widget-search form:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230, 0, 0, .12);
}

.widget-search input {
    flex: 1;
    min-width: 0;
    padding: 10px;
    border: 0;
    outline: none;
    font-family: inherit;
    font-size: 14px;
}

.widget-search button {
    padding: 10px 16px;
    background: var(--primary);
    color: #fff;
    border: 0;
    cursor: pointer;
    transition: background var(--t);
}

.widget-search button:hover { background: var(--primary-dark); }

.social-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: opacity var(--t), transform var(--t);
}

.social-btn:hover {
    opacity: .9;
    text-decoration: none;
    color: #fff;
    transform: translateY(-1px);
}

.social-fb { background: #3b5998; }
.social-wa { background: #25d366; }
.social-ig { background: #e1306c; }
.social-yt { background: #ff0000; }

.archive-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.archive-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.archive-list li:last-child { border-bottom: 0; }

.archive-list a { color: var(--text); font-size: 14px; }
.archive-list a:hover { color: var(--primary); text-decoration: none; }

.archive-list .count {
    background: var(--primary-soft);
    color: var(--primary-dark);
    padding: 1px 9px;
    border-radius: var(--pill);
    font-size: 12px;
    font-weight: 700;
}

/* ------------------------------------------------------- 11. APP DETAIL */
.app-detail {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}

.breadcrumb {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 14px;
}

.breadcrumb a { color: var(--gray); }
.breadcrumb a:hover { color: var(--primary); text-decoration: none; }

.post-title-main {
    margin: 0 0 8px;
    font-size: 26px;
    line-height: 1.3;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.app-detail .post-meta {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 18px;
}

.app-detail .post-meta span { margin-right: 14px; }

/* App header block */
.app-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--border);
}

.app-header-icon {
    flex: 0 0 72px;
    width: 72px;
    height: 72px;
    display: grid;
    place-items: center;
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.app-header-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.app-icon-letter {
    font-size: 30px;
    font-weight: 800;
    color: var(--primary);
}

.app-header-info { min-width: 0; flex: 1; }

.app-header-info .post-title-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.app-header-info .post-meta { margin-bottom: 8px; }

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--pill);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    line-height: 1.6;
}

.badge .fas, .badge .far { font-size: 10px; }

.badge-success { background: #dcfce7; color: #166534; }
.badge-pending { background: #fef9c3; color: #854d0e; }

.badge-ver {
    background: var(--primary);
    color: #fff;
    vertical-align: middle;
}

.badge-cat {
    background: #eef2f7;
    color: #37517e;
    text-decoration: none;
    margin-right: 6px;
}

.badge-cat:hover { background: #dde6f0; text-decoration: none; }

.badge-license { background: #e8f5e9; color: #1b5e20; }

.app-badges { margin-bottom: 2px; }

/* Specs table */
.app-specs {
    background: #fafbfc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 24px;
    overflow: hidden;
}

.app-specs table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.app-specs td {
    padding: 9px 14px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}

.app-specs tr:last-child td { border-bottom: 0; }

.app-specs td:first-child {
    width: 160px;
    color: var(--gray);
    font-weight: 600;
    white-space: nowrap;
}

.app-specs td:first-child .fas {
    width: 18px;
    color: var(--primary);
    text-align: center;
}

.app-specs td:last-child { color: var(--text); word-break: break-word; }
.app-specs td a { color: var(--primary); }

/* Article body */
.article-content {
    font-size: 15px;
    line-height: 1.8;
    color: var(--text);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.article-content h2,
.article-content h3,
.article-content h4 {
    border-left: 4px solid var(--primary);
    padding-left: 15px;
    margin-top: 30px;
    margin-bottom: 15px;
    color: var(--dark);
    font-weight: 700;
}

.article-content h2 { font-size: 22px; }
.article-content h3 { font-size: 20px; }
.article-content h4 { font-size: 18px; }

.article-content p { margin-bottom: 20px; display: block; }

.article-content ul,
.article-content ol { margin-bottom: 20px; padding-left: 30px; }

.article-content li { margin-bottom: 10px; list-style: disc; }

.article-content strong { font-weight: 700; color: var(--dark); }

.article-content img { border-radius: var(--radius-sm); }

/* Formatted description pieces */
.content-heading {
    background: #f8f9fa;
    border-left: 4px solid var(--primary) !important;
    border-radius: 0 6px 6px 0;
    padding: 8px 14px !important;
    margin-top: 26px !important;
    margin-bottom: 12px !important;
}

.article-content ul.fancy-list,
.article-content ol.fancy-list {
    list-style: none;
    padding-left: 6px;
    margin: 0 0 20px;
}

.article-content ul.fancy-list li,
.article-content ol.fancy-list li {
    list-style: none;
    position: relative;
    padding-left: 26px;
    margin-bottom: 8px;
    line-height: 1.7;
}

.article-content ul.fancy-list li::before {
    content: "\25B8";
    position: absolute;
    left: 4px;
    top: 0;
    color: var(--primary);
    font-weight: 700;
}

.article-content ol.fancy-list { counter-reset: step; }

.article-content ol.fancy-list li::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    left: 0;
    top: 2px;
    width: 19px;
    height: 19px;
    line-height: 19px;
    text-align: center;
    background: var(--primary);
    color: #fff;
    border-radius: var(--pill);
    font-size: 11px;
    font-weight: 700;
}

/* Generic numbered steps list */
.steps {
    counter-reset: steps;
    list-style: none;
    padding: 0;
    margin: 0 0 20px;
}

.steps li {
    counter-increment: steps;
    position: relative;
    list-style: none;
    padding: 0 0 0 38px;
    margin-bottom: 12px;
    line-height: 1.7;
}

.steps li::before {
    content: counter(steps);
    position: absolute;
    left: 0;
    top: 1px;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    background: var(--primary-soft);
    color: var(--primary-dark);
    border-radius: var(--pill);
    font-size: 12px;
    font-weight: 800;
}

.article-content .fancy-hr {
    border: none;
    height: 2px;
    background: linear-gradient(to right, var(--primary) 0%, #f0f0f0 70%, transparent 100%);
    margin: 26px 0;
}

/* Tags */
.app-tags {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--gray);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.app-tags .fas { color: var(--primary); margin-right: 2px; }

.tag-pill,
.tag {
    display: inline-block;
    background: var(--light);
    border: 1px solid var(--border);
    color: var(--gray);
    padding: 3px 11px;
    border-radius: var(--pill);
    font-size: 12px;
    text-decoration: none;
    transition: background var(--t), color var(--t), border-color var(--t);
}

.tag-pill:hover,
.tag:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    text-decoration: none;
}

/* Screenshots */
.screenshots-section {
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    max-width: 100%;
}

.screenshots-section h3 {
    margin: 0 0 14px;
    font-size: 18px;
    border-left: 4px solid var(--primary);
    padding-left: 12px;
}

.screenshots-section img {
    max-width: 100%;
    height: auto !important;
    display: block;
    margin: 15px auto;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
}

.screenshots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.screenshot-thumb {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--light);
    transition: border-color var(--t), transform var(--t), box-shadow var(--t);
}

.screenshot-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
}

.screenshot-thumb:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Share row */
.share-row {
    margin-top: 18px;
    padding: 10px 0;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.share-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray);
    margin-right: 4px;
}

.share-label .fas { color: var(--primary); }

.share-btn {
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border: none;
    border-radius: var(--pill);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: opacity var(--t), transform var(--t);
}

.share-btn:hover {
    opacity: .85;
    transform: translateY(-2px);
    text-decoration: none;
    color: #fff;
}

.share-tg { background: #0088cc; }
.share-tw { background: #17181c; }
.share-wa { background: #25d366; }
.share-fb { background: #1877f2; }
.share-copy { background: var(--gray); }

/* Related apps */
.related-section {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-xs);
    margin-top: 25px;
}

.related-title {
    margin: 0 0 16px;
    font-size: 18px;
    border-left: 4px solid var(--primary);
    padding-left: 12px;
}

.related-grid { display: block; }

/* ------------------------------------------------------ 12. DOWNLOAD BOX */
.download-section {
    background: #fafbfc;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 22px;
    margin-top: 28px;
    text-align: center;
}

.download-section h2 {
    margin-top: 0;
    font-size: 20px;
    border-left: 4px solid var(--primary);
    padding-left: 12px;
    text-align: left;
}

.download-section p { text-align: left; color: var(--gray); }

.important-note {
    background: #fff8e1;
    border-left: 4px solid #ffc107;
    padding: 16px;
    margin-top: 24px;
    border-radius: 0 8px 8px 0;
}

.important-note h4 {
    margin-top: 0;
    color: #856404;
    font-size: 15px;
}

.important-note p {
    margin-bottom: 0;
    color: #856404;
    font-size: 14px;
}

.downloader-page { text-align: center; }
.downloader-page h1 { text-align: left; }

.countdown-box {
    background: var(--light);
    padding: 30px;
    margin: 20px 0;
    border-radius: var(--radius);
}

.countdown-box p { margin: 0; color: var(--gray); }

.countdown-number {
    font-size: 72px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin: 10px 0;
    font-variant-numeric: tabular-nums;
}

.download-ready {
    padding: 20px;
    background: #f1f8f4;
    border: 1px solid #c8e6c9;
    border-radius: var(--radius);
    margin: 20px 0;
}

.copy-text {
    display: block;
    width: 100%;
    padding: 10px 12px;
    font-family: ui-monospace, Consolas, 'Courier New', monospace;
    font-size: 13px;
    color: var(--text);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin: 10px 0;
}

/* -------------------------------------------- 13. EMPTY STATES & MESSAGES */
.empty-state {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 46px 24px;
    text-align: center;
    box-shadow: var(--shadow-xs);
}

.empty-state h2,
.empty-state h3 {
    margin: 0 0 8px;
    font-size: 20px;
}

.empty-state p {
    margin: 0 0 6px;
    color: var(--gray);
    font-size: 14px;
}

.empty-state .btn-red { margin-top: 16px; }

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border-left: 4px solid;
    font-size: 14px;
    margin-bottom: 16px;
    background: var(--light);
    color: var(--text);
}

.alert-success {
    background: #eaf7ee;
    border-color: #2e7d32;
    color: #1b5e20;
}

.alert-error {
    background: #fdecec;
    border-color: #c62828;
    color: #8e1b1b;
}

.maintenance-box {
    max-width: 520px;
    margin: 80px auto;
    text-align: center;
    padding: 40px;
    background: var(--white);
    border: 1px solid var(--border);
    border-top: 4px solid var(--primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.maintenance-box h1 {
    color: var(--primary);
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 26px;
}

.maintenance-box p { color: var(--gray); }
.maintenance-box .btn-red { margin-top: 10px; }

/* --------------------------------------------------- 14. HOME EXTRAS */
.hero-section {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-xs);
}

.hero-section h1 {
    margin: 0 0 12px;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -.3px;
    color: var(--dark);
}

.hero-section summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--primary);
    font-size: 14px;
    list-style: none;
    display: inline-flex;
    align-items: center;
    gap: 7px;
}

.hero-section summary::-webkit-details-marker { display: none; }

.hero-section summary::after {
    content: "+";
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: var(--pill);
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 13px;
    line-height: 1;
    transition: transform var(--t);
}

.hero-section details[open] summary::after { content: "\2212"; }

.intro-text {
    margin-top: 12px;
    line-height: 1.75;
    font-size: 14px;
    color: var(--gray);
}

.intro-text p { margin: 0 0 12px; }
.intro-text p:last-child { margin-bottom: 0; }

/* "Why choose us" block above the footer */
.home-info {
    margin: 60px 0 40px;
    padding: 34px 36px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
}

.home-info h3 {
    margin: 0 0 15px;
    font-size: 22px;
    font-weight: 800;
    color: var(--dark);
    border-left: 5px solid var(--primary);
    padding-left: 15px;
}

.home-info p {
    margin: 0 0 14px;
    color: var(--gray);
    line-height: 1.8;
    font-size: 15px;
}

.home-info p:last-child { margin-bottom: 0; }

/* Pagination arrows on the homepage */
.pagination-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 34px 0 10px;
}

.pagination-nav .btn-red {
    padding: 12px 30px;
    font-size: 14px;
}

/* ------------------------------------------------------------- 15. FOOTER */
.site-footer {
    background: var(--dark);
    color: #a9adb4;
    padding: 40px 0 20px;
    margin-top: 30px;
}

.footer-inner {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}

.footer-inner h3 { color: #fff; margin-top: 0; font-size: 16px; }

.footer-brand h3 {
    margin-bottom: 8px;
    font-size: 20px;
    letter-spacing: -.3px;
}

.footer-brand p {
    margin: 0;
    font-size: 13px;
    line-height: 1.75;
    color: #9aa0a8;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 36px;
    width: 100%;
    margin: 22px 0 6px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.footer-links-col {
    display: flex;
    flex-direction: column;
    min-width: 150px;
}

.footer-links-col h4 {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .4px;
    text-transform: uppercase;
    margin: 0 0 12px;
    border-left: 3px solid var(--primary);
    padding-left: 10px;
}

.footer-links-col a {
    color: #b4b9c0;
    font-size: 13px;
    line-height: 2.1;
    text-decoration: none;
    transition: color var(--t);
}

.footer-links-col a:hover { color: #fff; }

.footer-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-box {
    background: #1e2025;
    padding: 15px 20px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: background var(--t);
}

.stat-box:hover { background: #24272d; }

.stat-box strong {
    color: #fff;
    font-size: 22px;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.stat-box span {
    color: #8c9299;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: .5px;
}

.copyright {
    border-top: 1px solid #2b2d31;
    padding-top: 20px;
    text-align: center;
    font-size: 13px;
    color: #8c9299;
}

/* ------------------------------------------------- 16. ADMIN SHELL */
.admin-body {
    background: #f1f5f9;
    color: #1e293b;
}

.admin-header {
    background: #0f172a;
    color: #fff;
    padding: .8rem 0;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .2);
}

.admin-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.admin-header .logo-main { color: #fff; }
.admin-header .logo-sub { color: #ef4444; }

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.admin-nav a {
    color: #cbd5e1;
    text-decoration: none;
    font-weight: 500;
    font-size: .88rem;
    padding: .45rem .75rem;
    border-radius: var(--radius-sm);
    transition: background var(--t), color var(--t);
}

.admin-nav a:hover {
    background: rgba(255, 255, 255, .1);
    color: #fff;
}

.admin-nav a.active {
    background: var(--primary);
    color: #fff;
}

.admin-main { padding: 2.5rem 0; }

.admin-main h1,
.section-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 1.25rem;
    letter-spacing: -.4px;
}

.admin-main h1 a,
.section-title a { color: var(--primary); }

/* Card wrapper used by every admin form */
.card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    padding: 1.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.admin-form-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
    max-width: 800px;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.form-group { margin-bottom: 1.5rem; }

.form-group label {
    display: block;
    margin-bottom: .45rem;
    font-weight: 600;
    color: #334155;
    font-size: .88rem;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: .7rem .9rem;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .94rem;
    color: #1e293b;
    background: #fff;
    transition: border-color var(--t), box-shadow var(--t);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230, 0, 0, .1);
}

.form-group textarea {
    min-height: 150px;
    resize: vertical;
}

.form-group small,
.form-group .help {
    display: block;
    margin-top: .35rem;
    font-size: .78rem;
    color: #64748b;
}

/* Dashboard cards */
.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2.5rem;
}

.admin-card {
    background: #fff;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
    border-bottom: 4px solid var(--primary);
}

.admin-card h3 {
    margin: 0 0 .5rem;
    font-size: .82rem;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.admin-card .value {
    font-size: 1.8rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
}

/* Tables */
.admin-table-container {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th,
.admin-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    font-size: .9rem;
}

.admin-table th {
    background: #f8fafc;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    font-size: .72rem;
    letter-spacing: .6px;
}

.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover { background: #f8fafc; }

/* Stat cards + charts */
.stat-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    padding: 1.25rem 1.4rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
    display: flex;
    align-items: center;
    gap: 1rem;
    border-left: 4px solid var(--primary);
}

.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #fff;
    flex-shrink: 0;
}

.stat-info h3 {
    margin: 0 0 .25rem;
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #64748b;
}

.stat-info .value {
    font-size: 1.5rem;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.stat-delta {
    display: inline-block;
    margin-top: 4px;
    font-size: .72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--pill);
}

.stat-delta.up { background: #d1fae5; color: #065f46; }
.stat-delta.down { background: #fee2e2; color: #991b1b; }
.stat-delta.flat { background: #e2e8f0; color: #475569; }

.chart-grid {
    display: grid;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.chart-grid.cols-2-1 { grid-template-columns: 2fr 1fr; }
.chart-grid.cols-1-1 { grid-template-columns: 1fr 1fr; }

.chart-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius);
    padding: 1.4rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.chart-card h3 {
    margin: 0 0 1rem;
    font-size: .95rem;
    color: #0f172a;
}

.chart-card h3 i { color: var(--primary); margin-right: 6px; }

.chart-note {
    margin: 10px 0 0;
    font-size: .78rem;
    color: #64748b;
}

.chart-wrap { position: relative; height: 320px; }
.chart-wrap.short { height: 300px; }

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    align-items: center;
    background: #fff;
    border: 1px solid #e2e8f0;
    padding: 1rem 1.2rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
    margin-bottom: 1.25rem;
}

.filter-bar select,
.filter-bar input[type=text] {
    padding: .5rem .7rem;
    border: 1px solid #cbd5e1;
    border-radius: var(--radius-sm);
    font-size: .85rem;
    font-family: inherit;
    background: #fff;
    color: #1e293b;
}

.filter-bar select:focus,
.filter-bar input[type=text]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230, 0, 0, .1);
}

.filter-bar label {
    font-size: .7rem;
    font-weight: 700;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-top: 1.5rem;
}

.pagination a,
.pagination span {
    padding: .45rem .8rem;
    border-radius: var(--radius-sm);
    font-size: .85rem;
    text-decoration: none;
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #334155;
    transition: background var(--t), border-color var(--t);
}

.pagination a:hover { background: #f1f5f9; }

.pagination .active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    font-weight: 700;
}

.pagination .disabled {
    color: #94a3b8;
    background: #f8fafc;
    cursor: default;
}

.result-count {
    font-size: .85rem;
    color: #64748b;
    margin: 0 0 1rem;
}

/* Login screen */
.login-box {
    max-width: 400px;
    margin: 8rem auto;
    background: #fff;
    padding: 2.5rem;
    border-radius: var(--radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, .1);
    border-top: 5px solid var(--primary);
}

.login-box h2 {
    margin: 0 0 1.75rem;
    text-align: center;
    font-weight: 800;
    font-size: 1.4rem;
}

.login-box .btn { width: 100%; margin-top: .5rem; padding: .75rem 1rem; }

/* Kept for compatibility with any older markup */
.admin-login-box {
    max-width: 400px;
    margin: 8rem auto;
    background: #fff;
    padding: 3rem;
    border-radius: var(--radius);
    box-shadow: 0 10px 25px rgba(0, 0, 0, .1);
    border-top: 5px solid var(--primary);
}

.admin-login-box h2 {
    margin: 0 0 2rem;
    text-align: center;
    font-weight: 800;
}

/* Archive year chips (moved out of archive.php inline <style>) */
.archive-nav {
    margin: -8px 0 20px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.archive-nav a {
    display: inline-block;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray);
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: color var(--t), border-color var(--t), background var(--t);
}

.archive-nav a:hover {
    color: var(--primary);
    border-color: var(--primary);
    text-decoration: none;
}

.archive-nav a.active {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

/* ------------------------------------------------------ 17. RESPONSIVE */
@media (max-width: 1000px) {
    .chart-grid.cols-2-1,
    .chart-grid.cols-1-1 { grid-template-columns: 1fr; }

    .chart-wrap,
    .chart-wrap.short { height: 260px; }
}

@media (max-width: 900px) {
    .page-layout { grid-template-columns: 1fr; }
    .post-card { grid-template-columns: 1fr; }
    .post-thumb { width: 100%; height: 200px; }
    .nav-inner { overflow-x: auto; }
    .header-inner { flex-direction: column; gap: 15px; align-items: stretch; }
    .header-search { max-width: none; }
    .two-col { grid-template-columns: 1fr; }
    .login-box { margin: 4rem auto; padding: 2rem 1.5rem; }
}

@media (max-width: 768px) {
    .app-header {
        flex-direction: row;
        gap: 12px;
    }

    .app-header-icon {
        flex-basis: 56px;
        width: 56px;
        height: 56px;
    }

    .app-specs td { padding: 7px 10px; font-size: 13px; }
    .app-specs td:first-child { width: 120px; }

    .share-row { gap: 6px; }

    .top-bar-inner { flex-wrap: wrap; justify-content: center; gap: 8px; }
    .top-links { display: flex; flex-wrap: wrap; justify-content: center; }
    .top-links a { margin: 0 8px; }

    .home-info { padding: 24px 20px; margin: 40px 0 30px; }
    .home-info h3 { font-size: 19px; }

    .hero-section { padding: 18px; }
    .hero-section h1 { font-size: 20px; }

    .app-detail { padding: 16px; }
    .post-title-main { font-size: 22px; }

    .footer-links { gap: 24px; }
    .stat-cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

@media (max-width: 480px) {
    .stat-card { flex-direction: column; align-items: flex-start; gap: .75rem; }
    .pagination-nav { flex-direction: column; align-items: stretch; }
    .pagination-nav .btn-red { text-align: center; }
    .countdown-number { font-size: 54px; }
}

/* --------------------------------------------------- 18. MOTION & PRINT */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }

    .post-card:hover,
    .btn-red:hover,
    .btn:hover,
    .share-btn:hover,
    .social-btn:hover,
    .screenshot-thumb:hover { transform: none; }

    .post-card:hover .post-thumb img { transform: none; }
}

@media print {
    .top-bar,
    .site-header,
    .main-nav,
    .sidebar,
    .site-footer,
    .share-row,
    .pagination-nav,
    .related-section { display: none !important; }

    body { background: #fff; }
    .page-layout { display: block; }
    .app-detail { border: 0; box-shadow: none; padding: 0; }
}
