/* POW Photos — styled to match protectourwinters.eu */

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

:root {
    --accent: #2ea3f2;
    --accent-hover: #1a8cd8;
    --dark: #1a1a1a;
    --text: #333;
    --text-light: #666;
    --bg: #ffffff;
    --bg-gray: #f7f8fa;
    --border: #e5e7eb;
    --radius: 6px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
    --transition: 0.2s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    background: var(--bg-gray);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

h1, h2, h3, h4 {
    font-family: 'Montserrat', 'Inter', sans-serif;
    font-weight: 700;
    color: var(--dark);
    line-height: 1.2;
}

h1 { font-size: 1.75rem; margin-bottom: 1.5rem; }
h2 { font-size: 1.35rem; margin-bottom: 1rem; }

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

a:hover {
    color: var(--accent-hover);
}

/* ── Header / Nav ── */
header {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-logo img {
    height: 32px;
    width: auto;
    display: block;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-links a {
    color: var(--text);
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.01em;
    transition: color var(--transition);
}

.nav-links a:hover {
    color: var(--accent);
}

.nav-user {
    background: var(--bg-gray);
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem !important;
}

.nav-logout-form {
    display: inline-flex;
    margin: 0;
}

.nav-logout-btn {
    border: none;
    cursor: pointer;
    color: var(--text);
    font-family: inherit;
    font-weight: 500;
    letter-spacing: 0.01em;
    transition: color var(--transition);
}

.nav-logout-btn:hover {
    color: var(--accent);
}

/* ── Main ── */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
    width: 100%;
    flex: 1;
}

/* ── Alerts ── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
}

.alert-error {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

/* ── Forms ── */
label {
    display: block;
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.35rem;
    color: var(--dark);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="file"],
select,
textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--text);
    background: var(--bg);
    transition: border-color var(--transition), box-shadow var(--transition);
    margin-bottom: 1rem;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(46, 163, 242, 0.15);
}

small {
    display: block;
    color: var(--text-light);
    font-size: 0.8rem;
    margin-top: -0.75rem;
    margin-bottom: 1rem;
}

fieldset {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1rem;
}

fieldset legend {
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0 0.5rem;
    color: var(--dark);
}

fieldset label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-right: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 400;
    cursor: pointer;
}

/* ── Buttons ── */
button, .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    font-family: 'Montserrat', 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.02em;
    border: 2px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
}

button, .btn-primary {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

button:hover, .btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: white;
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border-color: var(--accent);
}

.btn-outline:hover {
    background: var(--accent);
    color: white;
}

.btn-danger {
    background: transparent;
    color: #b91c1c;
    border-color: #b91c1c;
}

.btn-danger:hover {
    background: #b91c1c;
    color: white;
}

/* ── Card ── */
.card {
    background: var(--bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    padding: 2rem;
}

/* ── Photo Grid ── */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
    grid-auto-flow: row;
}

.photo-card {
    position: relative;
    display: block;
    background: var(--bg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: box-shadow var(--transition), transform var(--transition);
}

/* Stretched link: the photo link covers the whole card */
.photo-card .card-link::after {
    content: "";
    position: absolute;
    inset: 0;
}

.photo-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
    color: inherit;
}

.photo-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
}

.photo-info {
    padding: 0.75rem 1rem;
}

.photo-info strong {
    display: block;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.photo-info small {
    display: block;
    color: var(--text-light);
    font-size: 0.8rem;
    margin: 0;
    line-height: 1.4;
}

/* Instagram link sits above the stretched card link so it stays clickable */
.photo-info small a {
    position: relative;
    z-index: 1;
}

/* ── Tags ── */
.tags {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
}

.tag {
    background: var(--bg-gray);
    color: var(--text-light);
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.02em;
}

/* ── Detail Page ── */
.detail-image {
    max-width: 100%;
    max-height: 70vh;
    border-radius: var(--radius-lg);
    display: block;
    margin-bottom: 1.5rem;
}

.detail-meta {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.meta-item {
    padding: 0.75rem;
    background: var(--bg-gray);
    border-radius: var(--radius);
}

.meta-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-light);
    margin-bottom: 0.2rem;
}

.meta-value {
    font-size: 0.95rem;
    color: var(--dark);
    font-weight: 500;
}

.actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* ── Login Page ── */
.login-container {
    max-width: 400px;
    margin: 4rem auto;
}

.login-container .logo-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-container .logo-header img {
    height: 48px;
    margin-bottom: 0.75rem;
}

.login-container .logo-header p {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* ── Table ── */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

th, td {
    text-align: left;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}

th {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-light);
    background: var(--bg-gray);
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-light);
}

.empty-state p {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

/* ── Gallery Layout ── */
.gallery-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 2rem;
    align-items: start;
}

.filters {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    position: sticky;
    top: 80px;
}

.filter-group {
    margin-bottom: 1rem;
    position: relative;
}

.filter-group > label:first-child {
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-light);
    margin-bottom: 0.5rem;
    cursor: help;
}

.filter-group > label:first-child[data-tooltip] {
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-color: var(--text-light);
    text-underline-offset: 3px;
}

.filter-group > label:first-child[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 0;
    bottom: 100%;
    margin-bottom: 6px;
    padding: 6px 10px;
    background: var(--dark);
    color: white;
    font-size: 0.75rem;
    border-radius: var(--radius);
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
}

.filter-group input[type="text"],
.filter-group select {
    margin-bottom: 0;
}

.filter-check {
    display: flex !important;
    align-items: center;
    gap: 0.35rem;
    font-weight: 400 !important;
    font-size: 0.85rem;
    margin-bottom: 0.25rem;
    cursor: pointer;
    position: relative;
}

.filter-check[data-tooltip] {
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-color: var(--text-light);
    text-underline-offset: 3px;
}

.filter-check[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 0;
    bottom: 100%;
    margin-bottom: 6px;
    padding: 6px 10px;
    background: var(--dark);
    color: white;
    font-size: 0.75rem;
    border-radius: var(--radius);
    white-space: nowrap;
    z-index: 100;
    pointer-events: none;
}

.result-count {
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.gallery-main {
    min-width: 0;
}

/* ── Pagination ── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.page-info {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* ── Admin ── */
.admin-nav {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    text-align: center;
}

.stat-value {
    font-family: 'Montserrat', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

/* ── Download stats ── */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 220px;
    padding-top: 1.25rem;
}

.bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    min-width: 0;
}

.bar-col .bar {
    width: 100%;
    background: var(--accent);
    border-radius: 3px 3px 0 0;
    transition: background var(--transition);
}

.bar-col:hover .bar {
    background: var(--accent-hover);
}

.bar-count {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-light);
    line-height: 1.4;
}

.bar-label {
    font-size: 0.6rem;
    color: var(--text-light);
    line-height: 1.3;
    margin-top: 0.25rem;
    text-align: center;
    white-space: nowrap;
}

.table-thumb {
    width: 56px;
    height: 40px;
    object-fit: cover;
    border-radius: var(--radius);
    display: block;
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-light);
    margin-top: 0.25rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    align-items: start;
}

.form-row > div {
    flex: 1;
}

.btn-sm {
    padding: 0.3rem 0.65rem;
    font-size: 0.8rem;
    border-radius: 4px;
    border: 1px solid;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    background: transparent;
    transition: all var(--transition);
}

.btn-sm.btn-danger {
    color: #b91c1c;
    border-color: #b91c1c;
}

.btn-sm.btn-danger:hover {
    background: #b91c1c;
    color: white;
}

.btn-sm.btn-outline {
    color: var(--accent);
    border-color: var(--accent);
}

.btn-sm.btn-outline:hover {
    background: var(--accent);
    color: white;
}

.badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success {
    background: #f0fdf4;
    color: #166534;
}

.badge-error {
    background: #fef2f2;
    color: #b91c1c;
}

.badge-muted {
    background: var(--bg-gray);
    color: var(--text-light);
}

.badge-warning {
    background: #fffbeb;
    color: #92400e;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--bg-gray);
    border-radius: var(--radius);
    padding: 0.35rem 0.5rem;
}

.text-light {
    color: var(--text-light);
}

/* inline selects in tables */
td select {
    padding: 0.25rem 0.4rem;
    font-size: 0.85rem;
    margin-bottom: 0;
    width: auto;
}

/* ── Footer ── */
footer {
    text-align: center;
    padding: 2rem 1.5rem;
    color: var(--text-light);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

/* ── Responsive ── */
@media (max-width: 640px) {
    nav {
        height: auto;
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .nav-links {
        gap: 1rem;
        flex-wrap: wrap;
    }

    h1 { font-size: 1.35rem; }

    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 0.75rem;
    }

    .photo-card img {
        height: 160px;
    }

    .detail-meta {
        grid-template-columns: 1fr;
    }

    .gallery-layout {
        grid-template-columns: 1fr;
    }

    .filters {
        position: static;
    }

    main {
        padding: 1.25rem 1rem;
    }
}
