/* =========================
   KANHASHOP - MOBILE FIRST
   ========================= */

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #fafafa;
    color: #222;
}

/* =========================
   HEADER
   ========================= */

.header {
    position: sticky;
    top: 0;
    z-index: 100;

    height: 60px;
    padding: 0 16px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid #eee;
}

.logo {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

nav {
    display: flex;
    gap: 18px;
}

nav a {
    color: #444;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
}

nav a:hover,
nav a.active {
    color: #000;
    font-weight: 600;
}

/* =========================
   HERO
   ========================= */

.hero {
    padding: 45px 18px 30px;
    text-align: center;
}

.hero h1 {
    margin: 0 0 12px;
    font-size: 32px;
    line-height: 1.15;
    letter-spacing: -1px;
}

.hero p {
    margin: 0 auto;
    max-width: 500px;
    color: #777;
    font-size: 15px;
    line-height: 1.6;
}

/* =========================
   MAIN
   ========================= */

main {
    width: 100%;
    max-width: 1400px;
    margin: auto;
    padding: 0 12px 40px;
}

/* =========================
   CATEGORY CARDS
   ========================= */

.categories {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 35px;
}

.category-card {
    display: block;
    padding: 20px 12px;

    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;

    color: #222;
    text-align: center;
    text-decoration: none;

    transition: transform 0.15s ease;
}

.category-card:active {
    transform: scale(0.97);
}

.category-card h2 {
    margin: 0;
    font-size: 16px;
}

.category-card p {
    margin: 6px 0 0;
    color: #888;
    font-size: 12px;
}

/* =========================
   SECTION TITLE
   ========================= */

.section-title {
    margin: 0 0 15px;
    font-size: 20px;
}

/* =========================
   MASONRY GRID
   ========================= */

.photo-grid {
    columns: 2;
    column-gap: 8px;
}

.photo-item {
    display: block;
    width: 100%;

    margin: 0 0 8px;

    break-inside: avoid;

    overflow: hidden;
    border-radius: 8px;

    background: #eee;
}

.photo-item img {
    display: block;
    width: 100%;
    height: auto;

    /* Important for mobile loading */
    content-visibility: auto;

    transition: transform 0.25s ease;
}

.photo-item:active img {
    transform: scale(0.98);
}

/* =========================
   FULL SCREEN VIEWER
   ========================= */

.viewer {
    position: fixed;
    inset: 0;
    z-index: 1000;

    display: none;
    align-items: center;
    justify-content: center;

    padding: 15px;

    background: rgba(0, 0, 0, 0.94);
}

.viewer.active {
    display: flex;
}

.viewer img {
    max-width: 100%;
    max-height: 90vh;

    object-fit: contain;

    border-radius: 4px;
}

.viewer-close {
    position: absolute;
    top: 15px;
    right: 18px;

    width: 42px;
    height: 42px;

    border: 0;
    border-radius: 50%;

    background: rgba(255, 255, 255, 0.15);
    color: white;

    font-size: 26px;
    cursor: pointer;
}

.viewer-prev,
.viewer-next {
    position: absolute;

    top: 50%;
    transform: translateY(-50%);

    width: 42px;
    height: 42px;

    border: 0;
    border-radius: 50%;

    background: rgba(255, 255, 255, 0.15);
    color: white;

    font-size: 25px;
    cursor: pointer;
}

.viewer-prev {
    left: 12px;
}

.viewer-next {
    right: 12px;
}

/* =========================
   CATEGORY PAGE
   ========================= */

.category-header {
    padding: 25px 5px 18px;
}

.category-header h1 {
    margin: 0;
    font-size: 26px;
}

.category-header p {
    margin: 7px 0 0;
    color: #888;
}

/* =========================
   ADMIN
   ========================= */

.admin-container {
    max-width: 900px;
    margin: auto;
    padding: 25px 15px 50px;
}

.admin-container h1 {
    margin-top: 0;
}

.admin-form {
    padding: 18px;

    background: white;
    border: 1px solid #eee;
    border-radius: 12px;

    margin-bottom: 25px;
}

.admin-form label {
    display: block;
    margin-bottom: 8px;

    font-size: 14px;
    font-weight: 600;
}

.admin-form select,
.admin-form input {
    width: 100%;
    padding: 12px;

    border: 1px solid #ddd;
    border-radius: 8px;

    font-size: 15px;
}

.admin-form button {
    width: 100%;
    margin-top: 14px;
    padding: 12px;

    border: 0;
    border-radius: 8px;

    background: #111;
    color: white;

    font-size: 15px;
    cursor: pointer;
}

.admin-photo {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 10px;

    background: white;
    border-bottom: 1px solid #eee;
}

.admin-photo img {
    width: 70px;
    height: 70px;

    object-fit: cover;
    border-radius: 7px;
}

.delete-btn {
    margin-left: auto;

    padding: 8px 12px;

    border: 0;
    border-radius: 7px;

    background: #eee;
    color: #222;

    cursor: pointer;
}

/* =========================
   LOGIN
   ========================= */

.login-container {
    width: calc(100% - 30px);
    max-width: 400px;

    margin: 70px auto;
    padding: 25px;

    background: white;
    border: 1px solid #eee;
    border-radius: 14px;
}

.login-container h1 {
    margin-top: 0;
}

.login-container input {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;

    border: 1px solid #ddd;
    border-radius: 8px;
}

.login-container button {
    width: 100%;
    padding: 12px;

    border: 0;
    border-radius: 8px;

    background: #111;
    color: white;

    cursor: pointer;
}

/* =========================
   TABLET
   ========================= */

@media (min-width: 600px) {
    .header {
        padding: 0 25px;
    }

    .hero {
        padding: 70px 20px 45px;
    }

    .hero h1 {
        font-size: 42px;
    }

    main {
        padding: 0 20px 50px;
    }

    .categories {
        grid-template-columns: repeat(4, 1fr);
        gap: 14px;
    }

    .photo-grid {
        columns: 3;
        column-gap: 10px;
    }
}

/* =========================
   DESKTOP
   ========================= */

@media (min-width: 1000px) {
    .header {
        height: 68px;
        padding: 0 40px;
    }

    .logo {
        font-size: 23px;
    }

    nav {
        gap: 28px;
    }

    nav a {
        font-size: 15px;
    }

    .hero {
        padding: 90px 20px 55px;
    }

    .hero h1 {
        font-size: 52px;
    }

    .hero p {
        font-size: 16px;
    }

    main {
        padding: 0 35px 60px;
    }

    .photo-grid {
        columns: 4;
        column-gap: 12px;
    }

    .photo-item {
        margin-bottom: 12px;
        border-radius: 10px;
    }
}

/* =========================
   MOBILE PHOTO VIEWER
   ========================= */

@media (max-width: 600px) {
    /* Hide desktop controls on phone */
    .viewer-close,
    .viewer-prev,
    .viewer-next {
        display: none;
    }

    /* Make the viewer easier to interact with */
    .viewer {
        padding: 0;
        touch-action: pan-y;
    }

    .viewer img {
        max-width: 100%;
        max-height: 92vh;
        user-select: none;
        -webkit-user-drag: none;
    }
}
