/* ── Variables ── */
:root {
    --primary: #ff6b6b;
    --primary-dark: #ee5a24;
    --secondary: #6c5ce7;
    --accent: #fdcb6e;
    --green: #00b894;
    --green-dark: #00a381;
    --red: #e17055;
    --red-dark: #d63031;
    --orange: #f39c12;
    --orange-dark: #e67e22;
    --text: #2d3436;
    --text-light: #636e72;
    --text-muted: #b2bec3;
    --bg: #f7f8fc;
    --card: #ffffff;
    --border: #eef0f5;
    --shadow-sm: 0 2px 8px rgba(45,52,54,0.06);
    --shadow-md: 0 4px 20px rgba(45,52,54,0.08);
    --shadow-lg: 0 8px 40px rgba(45,52,54,0.12);
    --shadow-hover: 0 12px 48px rgba(45,52,54,0.16);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 8px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

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

html {
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    height: auto;
}

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
}

main.container {
    flex: 1;
    padding-top: 40px;
    padding-bottom: 60px;
}

/* ── Navbar ── */
.navbar {
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 1px 0 var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding-top: var(--safe-top);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 60px;
}

.logo {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: -0.5px;
    flex-shrink: 0;
}

.logo-icon {
    font-size: 1.5rem;
}

.nav-links {
    display: flex;
    gap: 6px;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 8px 14px;
    border-radius: var(--radius-xs);
    transition: all var(--transition);
    white-space: nowrap;
}

.nav-link:hover {
    background: rgba(108,92,231,0.08);
    color: var(--secondary);
}

.nav-link.active {
    background: var(--secondary);
    color: #fff;
}

/* Nav user badge */
.nav-user {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: linear-gradient(135deg, rgba(108,92,231,0.1) 0%, rgba(108,92,231,0.05) 100%);
    color: var(--secondary);
    border-radius: 20px;
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 0.3px;
}

.nav-user::before {
    content: "\1F464";
    font-size: 0.9rem;
}

.nav-logout {
    color: var(--text-muted) !important;
    font-size: 0.85rem;
}

.nav-logout:hover {
    color: var(--red) !important;
    background: rgba(225,112,85,0.08) !important;
}

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 110;
    -webkit-tap-highlight-color: transparent;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2.5px;
    background: var(--text);
    border-radius: 2px;
    transition: all var(--transition);
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}
.hamburger.active span:nth-child(2) {
    opacity: 0;
}
.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* ── Hero / Page Header ── */
.page-header {
    text-align: center;
    margin-bottom: 32px;
    padding: 16px 0;
}

.page-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -1px;
    margin-bottom: 8px;
}

.page-header .subtitle {
    color: var(--text-light);
    font-size: 1.05rem;
    font-weight: 400;
}

.hero {
    text-align: center;
    padding: 16px 20px 14px;
    margin: -40px -24px 24px;
    background: linear-gradient(135deg, #fff5f5 0%, #f0e6ff 50%, #e6f7ff 100%);
    border-radius: 0 0 20px 20px;
}

.hero h1 {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.hero .subtitle {
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 400;
}

/* ── Gallery Grid ── */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.image-card {
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition);
    position: relative;
}

.image-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-hover);
}

.image-card a {
    display: block;
    overflow: hidden;
}

.card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.comment-count {
    font-size: 0.8rem;
    color: var(--text-light);
    white-space: nowrap;
}

.image-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
    transition: transform var(--transition);
}

.image-card:hover img {
    transform: scale(1.05);
}

.card-info {
    padding: 14px 18px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
}

.card-info h3 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    word-break: break-word;
}

.date {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* ── Detail Layout (side-by-side on desktop) ── */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 28px;
    align-items: start;
}

.detail-left {
    min-width: 0;
}

.detail-right {
    min-width: 0;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.detail-right::-webkit-scrollbar {
    width: 4px;
}

.detail-right::-webkit-scrollbar-track {
    background: transparent;
}

.detail-right::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.detail-right .comments-section {
    margin-top: 0;
}

.detail-right .image-detail {
    margin-bottom: 0;
}

/* ── Image Detail ── */
.image-detail {
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    margin-bottom: 28px;
}

.image-detail-main {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-detail-main img {
    width: 100%;
    max-height: 600px;
    object-fit: contain;
    display: block;
}

.image-detail-info {
    padding: 24px 28px;
}

.image-detail-info h1 {
    font-size: 1.6rem;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    word-break: break-word;
}

.image-detail-info .description {
    color: var(--text-light);
    margin-bottom: 8px;
    font-size: 1rem;
    word-break: break-word;
}

.detail-meta {
    margin-bottom: 4px;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--secondary);
    text-decoration: none;
    font-weight: 600;
    margin-bottom: 16px;
    font-size: 0.95rem;
    transition: color var(--transition);
    padding: 4px 0;
}

.back-link:hover {
    color: var(--primary-dark);
}

/* ── Comments ── */
.comments-section {
    margin-top: 12px;
}

.comments-section h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.comment {
    background: var(--card);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    border-left: 3px solid var(--secondary);
    transition: box-shadow var(--transition);
}

.comment:hover {
    box-shadow: var(--shadow-md);
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 8px;
    flex-wrap: wrap;
}

.comment-header strong {
    color: var(--secondary);
    font-size: 0.9rem;
}

.comment p {
    color: var(--text-light);
    line-height: 1.6;
    word-break: break-word;
}

.comment-form-wrapper {
    background: var(--card);
    border-radius: var(--radius);
    padding: 24px 28px;
    margin-top: 20px;
    box-shadow: var(--shadow-sm);
}

.comment-form-wrapper h3 {
    margin-bottom: 16px;
    font-weight: 700;
}

/* ── Forms ── */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 16px; /* prevents iOS zoom globally */
    font-family: inherit;
    transition: all var(--transition);
    background: #fafbfe;
    color: var(--text);
    -webkit-appearance: none;
    appearance: none;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--secondary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(108,92,231,0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

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

.form-note {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-top: 8px;
}

.file-upload {
    border: 2px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 28px 16px;
    text-align: center;
    transition: all var(--transition);
    cursor: pointer;
    background: #fafbfe;
}

.file-upload:hover {
    border-color: var(--secondary);
    background: rgba(108,92,231,0.03);
}

.file-upload-icon {
    font-size: 2.2rem;
    margin-bottom: 8px;
    display: block;
}

.preview-container img {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    display: block;
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    box-shadow: 0 4px 16px rgba(255,107,107,0.3);
}

.btn-primary:hover {
    box-shadow: 0 6px 24px rgba(255,107,107,0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary) 0%, #5f3dc4 100%);
    color: #fff;
    box-shadow: 0 4px 16px rgba(108,92,231,0.3);
}

.btn-approve {
    background: linear-gradient(135deg, var(--green) 0%, var(--green-dark) 100%);
    color: #fff;
    padding: 10px 18px;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(0,184,148,0.3);
}

.btn-approve:hover {
    box-shadow: 0 4px 16px rgba(0,184,148,0.4);
    transform: translateY(-1px);
}

.btn-delete {
    background: linear-gradient(135deg, var(--red) 0%, var(--red-dark) 100%);
    color: #fff;
    padding: 10px 18px;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(225,112,85,0.3);
}

.btn-delete:hover {
    box-shadow: 0 4px 16px rgba(225,112,85,0.4);
    transform: translateY(-1px);
}

.btn-warn {
    background: linear-gradient(135deg, var(--orange) 0%, var(--orange-dark) 100%);
    color: #fff;
    padding: 10px 18px;
    font-size: 0.85rem;
    box-shadow: 0 2px 8px rgba(243,156,18,0.3);
}

.btn-warn:hover {
    box-shadow: 0 4px 16px rgba(243,156,18,0.4);
    transform: translateY(-1px);
}

/* ── Alerts ── */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-weight: 600;
    font-size: 0.9rem;
    animation: slideDown 0.4s ease;
    word-break: break-word;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.alert.success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    border-left: 4px solid var(--green);
}

.alert.error {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border-left: 4px solid var(--red);
}

/* ── Login ── */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 16px;
}

.login-card {
    background: var(--card);
    border-radius: var(--radius);
    padding: 40px 36px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.login-card .login-icon {
    font-size: 2.8rem;
    margin-bottom: 8px;
    display: block;
}

.login-card h1 {
    margin-bottom: 8px;
    color: var(--text);
    font-weight: 800;
    font-size: 1.5rem;
}

.login-card p {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 0.9rem;
}

.login-form .form-group {
    text-align: left;
}

.login-form .btn {
    width: 100%;
    margin-top: 8px;
}

/* ── Upload Layout ── */
.upload-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
    align-items: start;
}

.upload-form {
    background: var(--card);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 80px;
}

.upload-form-title {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--text);
}

.label-hint {
    font-weight: 400;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.upload-form .btn-primary {
    width: 100%;
    padding: 14px;
    font-size: 1rem;
}

.upload-form .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-icon {
    font-size: 1.1rem;
}

.file-upload.drag-over {
    border-color: var(--secondary);
    background: rgba(108,92,231,0.05);
}

.file-upload.file-selected {
    border-color: var(--green);
    background: rgba(0,184,148,0.04);
}

.file-upload input[type="file"] {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    pointer-events: none;
}

.file-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--green);
    margin-top: 4px;
}

.preview-container {
    position: relative;
    margin-bottom: 16px;
}

.preview-remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ── Admin ── */
.admin-section {
    margin-bottom: 40px;
}

.admin-section h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
    flex-wrap: wrap;
}

.badge {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 12px;
    border-radius: 20px;
    min-width: 28px;
    text-align: center;
}

.admin-card {
    background: var(--card);
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    margin-bottom: 14px;
    display: flex;
    border-left: 4px solid var(--orange);
    transition: box-shadow var(--transition);
}

.admin-card:hover {
    box-shadow: var(--shadow-md);
}

.admin-card.approved {
    border-left-color: var(--green);
}

.admin-card img {
    width: 140px;
    height: 120px;
    object-fit: cover;
    flex-shrink: 0;
}

.admin-card-info {
    padding: 14px 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.admin-card-info h4 {
    color: var(--text);
    font-weight: 700;
    word-break: break-word;
}

.admin-card-info p {
    color: var(--text-light);
    font-size: 0.85rem;
    word-break: break-word;
}

.admin-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 8px;
    flex-wrap: wrap;
}

.admin-comment {
    background: var(--card);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    border-left: 4px solid var(--orange);
    transition: box-shadow var(--transition);
}

.admin-comment:hover {
    box-shadow: var(--shadow-md);
}

.admin-comment p {
    color: var(--text-light);
    margin: 6px 0;
    word-break: break-word;
}

/* ── Star Ratings ── */
.stars-display {
    display: flex;
    align-items: center;
    gap: 1px;
    margin-top: 4px;
}

.star {
    font-size: 1rem;
    line-height: 1;
}

.star-full {
    color: #f9ca24;
}

.star-half {
    color: #f9ca24;
    opacity: 0.6;
}

.star-empty {
    color: #dfe6e9;
}

.rating-count {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-left: 4px;
    font-weight: 600;
}

/* Interactive rating on detail page */
.rating-interactive {
    margin-top: 14px;
    padding: 14px 0;
    border-top: 1px solid var(--border);
}

.stars-row {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.star-clickable {
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    padding: 2px;
}

.star-clickable:hover,
.star-clickable.star-hover {
    color: #f9ca24 !important;
    transform: scale(1.2);
}

.star-clickable.active {
    color: #f9ca24;
}

.rating-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.rating-avg {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text);
}

.rating-yours {
    font-size: 0.82rem;
    color: var(--secondary);
    padding: 3px 10px;
    background: rgba(108,92,231,0.08);
    border-radius: 12px;
}

/* ── Empty State ── */
.empty {
    text-align: center;
    color: var(--text-muted);
    padding: 48px 16px;
    font-size: 1rem;
    font-weight: 600;
}

.empty::before {
    content: "\1F5BC\FE0F";
    display: block;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

/* ── My Images (upload page) ── */
.my-images-section {
    margin-top: 0;
}

.my-images-section h2 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--border);
}

.my-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
}

.my-image-card {
    background: var(--card);
    border-radius: var(--radius-sm);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
    display: flex;
    flex-direction: column;
}

.my-image-card:hover {
    box-shadow: var(--shadow-md);
}

.my-image-card img {
    width: 100%;
    height: 120px;
    object-fit: cover;
}

.my-image-info {
    padding: 10px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.my-image-info h4 {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    word-break: break-word;
}

.badge-small {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    width: fit-content;
}

.badge-approved {
    background: rgba(0,184,148,0.12);
    color: var(--green-dark);
}

.badge-pending {
    background: rgba(243,156,18,0.12);
    color: var(--orange-dark);
}

.btn-small {
    padding: 8px 14px;
    font-size: 0.78rem;
    text-align: center;
    text-decoration: none;
    margin: 0 12px 12px;
    min-height: 36px;
}

.btn-edit {
    background: linear-gradient(135deg, var(--secondary) 0%, #5f3dc4 100%);
    color: #fff;
    border-radius: var(--radius-xs);
}

.empty-small {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
    font-size: 0.9rem;
}

/* ── Edit Image Preview ── */
.edit-image-preview {
    text-align: center;
    margin-bottom: 20px;
}

.edit-image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    transition: opacity 0.2s;
}

.rotate-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 12px;
}

.btn-rotate {
    background: var(--card);
    color: var(--text);
    border: 2px solid var(--border);
    padding: 8px 18px;
    font-size: 0.85rem;
    font-weight: 700;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all var(--transition);
}

.btn-rotate:hover {
    border-color: var(--secondary);
    color: var(--secondary);
    background: rgba(108,92,231,0.05);
}

/* ── Nav Settings Icon ── */
.nav-settings {
    font-size: 1.1rem !important;
    padding: 8px 10px !important;
    opacity: 0.6;
    transition: opacity var(--transition);
}

.nav-settings:hover {
    opacity: 1;
}

/* ── Visitor Counter ── */
.visitor-counter {
    margin-top: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-muted);
    flex-wrap: wrap;
}

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

.visitor-sep {
    color: var(--border);
    margin: 0 2px;
}

/* ── Footer ── */
.footer {
    background: var(--card);
    text-align: center;
    padding: 20px 16px;
    padding-bottom: calc(20px + var(--safe-bottom));
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    margin-top: auto;
    border-top: 1px solid var(--border);
}

/* ── Animations ── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.image-card {
    animation: fadeInUp 0.5s ease both;
}

.image-card:nth-child(2) { animation-delay: 0.05s; }
.image-card:nth-child(3) { animation-delay: 0.1s; }
.image-card:nth-child(4) { animation-delay: 0.15s; }
.image-card:nth-child(5) { animation-delay: 0.2s; }
.image-card:nth-child(6) { animation-delay: 0.25s; }

/* ══════════════════════════════════════════════
   RESPONSIVE - TABLET (769px - 1024px)
   ══════════════════════════════════════════════ */
@media (min-width: 769px) and (max-width: 1024px) {
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .image-card img {
        height: 200px;
    }

    .detail-layout {
        grid-template-columns: 1fr 340px;
        gap: 20px;
    }
}

/* ══════════════════════════════════════════════
   RESPONSIVE - MOBILE (max-width: 768px)
   ══════════════════════════════════════════════ */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }

    main.container {
        padding-top: 20px;
        padding-bottom: 32px;
    }

    /* ── Mobile Navbar ── */
    .nav-container {
        height: 56px;
    }

    .hamburger {
        display: flex;
    }

    .nav-links {
        display: none;
        position: fixed;
        top: 56px;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(255,255,255,0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        flex-direction: column;
        padding: 20px 24px;
        gap: 4px;
        z-index: 99;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-links.open {
        display: flex;
        animation: slideDown 0.3s ease;
    }

    .nav-link {
        padding: 14px 16px;
        font-size: 1.05rem;
        border-radius: var(--radius-xs);
        min-height: 48px;
        display: flex;
        align-items: center;
    }

    .nav-user {
        padding: 12px 16px;
        font-size: 0.9rem;
        justify-content: center;
        margin: 8px 0;
    }

    .nav-settings {
        justify-content: center;
        font-size: 1.2rem !important;
        min-height: 48px;
    }

    .nav-logout {
        font-size: 1rem !important;
        min-height: 48px;
    }

    /* ── Mobile Hero ── */
    .hero {
        padding: 12px 16px 10px;
        margin: -20px -16px 16px;
        border-radius: 0 0 14px 14px;
    }

    .hero h1 {
        font-size: 1.2rem;
    }

    .hero .subtitle {
        font-size: 0.8rem;
    }

    .page-header {
        margin-bottom: 24px;
        padding: 12px 0;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }

    .page-header .subtitle {
        font-size: 0.9rem;
    }

    /* ── Mobile Gallery Grid ── */
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .image-card img {
        height: 150px;
    }

    .image-card:hover {
        transform: none;
    }

    .image-card:hover img {
        transform: none;
    }

    .card-info {
        padding: 10px 12px;
    }

    .card-info h3 {
        font-size: 0.82rem;
    }

    .stars-display .star {
        font-size: 0.85rem;
    }

    .stars-display .rating-count {
        font-size: 0.65rem;
    }

    /* ── Mobile Detail Layout ── */
    .detail-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .detail-right {
        position: static;
        max-height: none;
        overflow-y: visible;
    }

    /* ── Mobile Image Detail ── */
    .image-detail {
        border-radius: var(--radius-sm);
        margin-bottom: 0;
    }

    .image-detail-main img {
        max-height: 400px;
    }

    .image-detail-info {
        padding: 16px;
    }

    .image-detail-info h1 {
        font-size: 1.3rem;
    }

    .image-detail-info .description {
        font-size: 0.9rem;
    }

    .back-link {
        margin-bottom: 12px;
        font-size: 0.9rem;
    }

    /* ── Mobile Star Rating ── */
    .rating-interactive {
        margin-top: 12px;
        padding: 12px 0;
    }

    .stars-row {
        gap: 8px;
        justify-content: flex-start;
    }

    .star-clickable {
        font-size: 2.2rem;
        padding: 4px;
    }

    .rating-avg {
        font-size: 1.1rem;
    }

    .rating-info {
        gap: 6px;
    }

    .rating-yours {
        font-size: 0.78rem;
    }

    /* ── Mobile Comments ── */
    .comments-section h2 {
        font-size: 1.15rem;
        margin-bottom: 12px;
    }

    .comment {
        padding: 14px 16px;
        margin-bottom: 10px;
    }

    .comment-header strong {
        font-size: 0.85rem;
    }

    .comment-header .date {
        font-size: 0.72rem;
    }

    .comment p {
        font-size: 0.9rem;
    }

    .comment-form-wrapper {
        padding: 18px 16px;
        margin-top: 16px;
    }

    .comment-form-wrapper h3 {
        font-size: 1rem;
        margin-bottom: 14px;
    }

    /* ── Mobile Forms ── */
    .form-group {
        margin-bottom: 14px;
    }

    .form-group label {
        font-size: 0.8rem;
        margin-bottom: 5px;
    }

    .form-group input[type="text"],
    .form-group input[type="password"],
    .form-group textarea {
        padding: 12px 14px;
        font-size: 16px;
        border-radius: var(--radius-xs);
    }

    .form-group textarea {
        min-height: 70px;
    }

    .file-upload {
        padding: 24px 14px;
    }

    .file-upload-icon {
        font-size: 1.8rem;
    }

    .file-upload p {
        font-size: 0.9rem;
    }

    .preview-container img {
        max-height: 200px;
    }

    /* ── Mobile Upload Layout ── */
    .upload-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .upload-form {
        padding: 20px 16px;
        border-radius: var(--radius-sm);
        position: static;
    }

    .upload-form .btn-primary {
        padding: 14px;
        font-size: 0.95rem;
    }

    /* ── Mobile My Images ── */
    .my-images-section {
        margin-top: 0;
    }

    .my-images-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .my-image-card img {
        height: 100px;
    }

    .my-image-info {
        padding: 8px 10px;
    }

    .my-image-info h4 {
        font-size: 0.78rem;
    }

    .btn-small {
        margin: 0 10px 10px;
        padding: 8px 12px;
        font-size: 0.75rem;
        min-height: 38px;
    }

    /* ── Mobile Login ── */
    .login-page {
        min-height: 55vh;
        padding: 16px 8px;
        align-items: flex-start;
        padding-top: 10vh;
    }

    .login-card {
        padding: 28px 20px;
        border-radius: var(--radius-sm);
    }

    .login-card .login-icon {
        font-size: 2.2rem;
    }

    .login-card h1 {
        font-size: 1.3rem;
    }

    .login-card p {
        font-size: 0.85rem;
        margin-bottom: 20px;
    }

    /* ── Mobile Edit Image ── */
    .edit-image-preview img {
        max-height: 200px;
    }

    /* ── Mobile Admin ── */
    .admin-section {
        margin-bottom: 32px;
    }

    .admin-section h2 {
        font-size: 1.05rem;
    }

    .admin-card {
        flex-direction: column;
    }

    .admin-card img {
        width: 100%;
        height: 180px;
    }

    .admin-card-info {
        padding: 14px 16px;
    }

    .admin-card-info h4 {
        font-size: 0.95rem;
    }

    .admin-actions {
        gap: 6px;
    }

    .admin-actions .btn {
        flex: 1;
        min-width: 0;
        padding: 10px 12px;
        font-size: 0.82rem;
    }

    .admin-comment {
        flex-direction: column;
        padding: 14px 16px;
        gap: 10px;
    }

    .admin-comment .admin-actions {
        width: 100%;
    }

    /* ── Mobile Buttons ── */
    .btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    .btn-primary {
        width: 100%;
    }

    .btn-secondary {
        width: 100%;
    }

    /* ── Mobile Alerts ── */
    .alert {
        padding: 12px 14px;
        font-size: 0.85rem;
    }

    /* ── Mobile Footer ── */
    .footer {
        padding: 16px 12px;
        padding-bottom: calc(16px + var(--safe-bottom));
        font-size: 0.78rem;
    }

    .visitor-counter {
        font-size: 0.72rem;
        gap: 4px;
    }
}

/* ══════════════════════════════════════════════
   RESPONSIVE - SMALL MOBILE (max-width: 380px)
   ══════════════════════════════════════════════ */
@media (max-width: 380px) {
    .container {
        padding: 0 12px;
    }

    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .image-card img {
        height: 200px;
    }

    .card-info h3 {
        font-size: 0.9rem;
    }

    .hero {
        margin: -20px -12px 20px;
    }

    .hero h1 {
        font-size: 1.4rem;
    }

    .logo {
        font-size: 1.05rem;
    }

    .logo-icon {
        font-size: 1.2rem;
    }

    .star-clickable {
        font-size: 2rem;
        gap: 4px;
    }

    .my-images-grid {
        grid-template-columns: 1fr;
    }

    .my-image-card img {
        height: 160px;
    }

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

    .login-card {
        padding: 24px 16px;
    }
}

/* ══════════════════════════════════════════════
   TOUCH DEVICE OPTIMIZATIONS
   ══════════════════════════════════════════════ */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn {
        min-height: 48px;
    }

    .nav-link {
        min-height: 48px;
        display: flex;
        align-items: center;
    }

    .form-group input,
    .form-group textarea {
        min-height: 48px;
    }

    /* Disable hover effects on touch */
    .image-card:hover {
        transform: none;
        box-shadow: var(--shadow-sm);
    }

    .image-card:hover img {
        transform: none;
    }

    .comment:hover {
        box-shadow: var(--shadow-sm);
    }

    .admin-card:hover {
        box-shadow: var(--shadow-sm);
    }

    .admin-comment:hover {
        box-shadow: var(--shadow-sm);
    }

    /* Star rating touch-friendly */
    .star-clickable {
        padding: 6px;
    }

    /* Active states for touch feedback */
    .image-card:active {
        transform: scale(0.98);
    }

    .btn:active {
        transform: scale(0.95);
    }

    .comment:active {
        box-shadow: var(--shadow-md);
    }
}

/* ══════════════════════════════════════════════
   LANDSCAPE MOBILE
   ══════════════════════════════════════════════ */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        padding: 16px 16px 12px;
    }

    .hero h1 {
        font-size: 1.4rem;
    }

    .login-page {
        min-height: auto;
        padding-top: 20px;
    }

    .image-detail-main img {
        max-height: 300px;
    }

    .nav-links {
        top: 56px;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        bottom: auto;
        padding: 12px 16px;
    }
}

/* ══════════════════════════════════════════════
   PRINT STYLES
   ══════════════════════════════════════════════ */
@media print {
    .navbar, .hamburger, .footer, .comment-form-wrapper, .admin-actions, .btn {
        display: none !important;
    }

    body {
        background: #fff;
    }

    .image-detail-main img {
        max-height: none;
    }
}
