/* ===========================
   Rubfindr - Japanese-Inspired Minimalist Design
   Editorial Aesthetic with Refined Details
   =========================== */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600&display=swap');

/* CSS Variables - Minimalist Palette */
:root {
    /* Core Colors */
    --ink: #1a1a1a;
    --ink-light: #2d2d2d;
    --ink-muted: #5c5c5c;
    --stone: #8a8a8a;
    --mist: #c4c4c4;
    --cloud: #e8e8e8;
    --paper: #f7f6f4;
    --white: #ffffff;

    /* Accent */
    --rust: #b86b4a;
    --rust-light: #d4917a;
    --rust-dark: #8b4d32;

    /* Semantic */
    --success: #4a7c59;
    --error: #c45c5c;
    --info: #5c7c9c;

    /* Typography */
    --font-serif: 'Instrument Serif', 'Georgia', serif;
    --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Font Sizes - Fluid Scale */
    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.9375rem;
    --text-lg: 1.0625rem;
    --text-xl: 1.25rem;
    --text-2xl: 1.5rem;
    --text-3xl: 2rem;
    --text-4xl: 2.75rem;
    --text-5xl: 3.5rem;

    /* Spacing - 4px base */
    --sp-1: 0.25rem;
    --sp-2: 0.5rem;
    --sp-3: 0.75rem;
    --sp-4: 1rem;
    --sp-5: 1.25rem;
    --sp-6: 1.5rem;
    --sp-8: 2rem;
    --sp-10: 2.5rem;
    --sp-12: 3rem;
    --sp-16: 4rem;
    --sp-20: 5rem;
    --sp-24: 6rem;

    /* Legacy spacing aliases */
    --space-xs: var(--sp-1);
    --space-sm: var(--sp-2);
    --space-md: var(--sp-4);
    --space-lg: var(--sp-6);
    --space-xl: var(--sp-8);
    --space-2xl: var(--sp-12);
    --space-3xl: var(--sp-16);

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-2xl: 20px;
    --radius-full: 9999px;

    /* Shadows - Subtle */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --duration-fast: 150ms;
    --duration-base: 250ms;
    --duration-slow: 400ms;
    --transition-fast: 150ms cubic-bezier(0.16, 1, 0.3, 1);
    --transition-base: 250ms cubic-bezier(0.16, 1, 0.3, 1);
    --transition-slow: 400ms cubic-bezier(0.16, 1, 0.3, 1);

    /* Legacy color aliases */
    --color-clay: var(--rust);
    --color-terracotta: var(--rust-light);
    --color-charcoal: var(--ink);
    --color-forest: var(--ink-muted);
    --color-sage: var(--stone);
    --color-sand: var(--cloud);
    --color-cream: var(--paper);
    --color-white: var(--white);
}

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

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

body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: 1.6;
    color: var(--ink);
    background: var(--paper);
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-serif);
    font-weight: 400;
    line-height: 1.2;
    color: var(--ink);
    letter-spacing: -0.02em;
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

p {
    margin-bottom: var(--sp-4);
    color: var(--ink-muted);
}

a {
    color: var(--ink);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}

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

/* Container */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--sp-6);
}

/* ===========================
   Navigation - Minimal Header
   =========================== */
.navbar {
    background: var(--white);
    border-bottom: 1px solid var(--cloud);
    padding: var(--sp-4) 0;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    background: rgba(255, 255, 255, 0.95);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    font-family: var(--font-serif);
    font-size: var(--text-xl);
    color: var(--ink);
    text-decoration: none;
    transition: opacity var(--duration-fast);
}

.logo:hover {
    opacity: 0.7;
    color: var(--ink);
}

.logo-icon-text {
    font-size: var(--text-2xl);
}

.logo-text {
    font-style: italic;
    letter-spacing: -0.03em;
}

.logo-img {
    max-height: 40px;
    width: auto;
    object-fit: contain;
}

.city-badge {
    background: var(--paper);
    border: 1px solid var(--cloud);
    padding: var(--sp-2) var(--sp-4);
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--ink-muted);
}

.nav-links {
    display: flex;
    gap: var(--sp-6);
    align-items: center;
}

.nav-links a {
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--ink-muted);
    transition: color var(--duration-fast);
    position: relative;
}

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

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--ink);
    transition: width var(--duration-base) var(--ease-out);
}

.nav-links a:hover::after {
    width: 100%;
}

.logo-icon {
    background: var(--paper);
    border: 1px solid var(--cloud);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-md);
    font-size: var(--text-base);
    transition: all var(--duration-fast);
}

.logo-icon:hover {
    background: var(--cloud);
    border-color: var(--mist);
}

#lang-selector {
    background: var(--paper);
    border: 1px solid var(--cloud);
    color: var(--ink-muted);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all var(--duration-fast);
}

#lang-selector:hover {
    border-color: var(--mist);
}

/* ===========================
   Buttons
   =========================== */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-6);
    background: var(--ink);
    color: var(--white) !important;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-out);
    text-decoration: none;
}

.btn-primary:hover {
    background: var(--ink-light);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    color: var(--white) !important;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-6);
    background: var(--white);
    color: var(--ink);
    border: 1px solid var(--cloud);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-out);
    text-decoration: none;
}

.btn-secondary:hover {
    background: var(--paper);
    border-color: var(--mist);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-2);
    padding: var(--sp-3) var(--sp-6);
    background: var(--error);
    color: var(--white);
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: var(--text-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--duration-base) var(--ease-out);
}

.btn-danger:hover {
    opacity: 0.9;
}

/* ===========================
   Main Content
   =========================== */
main {
    padding: var(--sp-12) 0;
    min-height: calc(100vh - 200px);
}

/* ===========================
   Cards - Clean & Minimal
   =========================== */
.card {
    background: var(--white);
    border: 1px solid var(--cloud);
    border-radius: var(--radius-xl);
    padding: var(--sp-8);
    transition: all var(--duration-base) var(--ease-out);
}

.card:hover {
    border-color: var(--mist);
    box-shadow: var(--shadow-sm);
}

/* ===========================
   Forms - Refined Inputs
   =========================== */
.form-group {
    margin-bottom: var(--sp-6);
}

.form-group label {
    display: block;
    margin-bottom: var(--sp-2);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--ink);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: var(--sp-3) var(--sp-4);
    background: var(--white);
    border: 1px solid var(--cloud);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: var(--text-base);
    color: var(--ink);
    transition: all var(--duration-fast);
}

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

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

.form-group textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.6;
}

/* ===========================
   Alerts - Subtle & Clear
   =========================== */
.alert {
    padding: var(--sp-4) var(--sp-5);
    border-radius: var(--radius-md);
    margin-bottom: var(--sp-6);
    font-size: var(--text-sm);
    font-weight: 500;
    border-left: 3px solid;
}

.alert-success {
    background: #f0f7f2;
    border-color: var(--success);
    color: var(--success);
}

.alert-error {
    background: #fef5f5;
    border-color: var(--error);
    color: var(--error);
}

.alert-warning {
    background: #fef9f0;
    border-color: #c49b5c;
    color: #8b6d3f;
}

/* ===========================
   Posts Grid - Card Layout
   =========================== */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--sp-6);
}

.post-card {
    background: var(--white);
    border: 1px solid var(--cloud);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--duration-base) var(--ease-out);
}

.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--mist);
}

.post-card img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.post-card-content {
    padding: var(--sp-5);
}

.post-card h3 {
    font-size: var(--text-lg);
    margin-bottom: var(--sp-2);
}

.post-card-meta {
    font-size: var(--text-xs);
    color: var(--stone);
}

/* ===========================
   Skills Badges
   =========================== */
.skills-list {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
}

.skill-badge {
    background: var(--paper);
    color: var(--ink-muted);
    padding: var(--sp-2) var(--sp-3);
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 500;
    border: 1px solid var(--cloud);
}

/* ===========================
   Admin Table - Clean
   =========================== */
.admin-table {
    width: 100%;
    background: var(--white);
    border: 1px solid var(--cloud);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

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

.admin-table th,
.admin-table td {
    padding: var(--sp-4) var(--sp-5);
    text-align: left;
    border-bottom: 1px solid var(--cloud);
}

.admin-table th {
    background: var(--paper);
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--stone);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: var(--paper);
}

/* ===========================
   Footer - Minimal
   =========================== */
footer {
    background: var(--ink);
    color: var(--white);
    padding: var(--sp-16) 0 var(--sp-8);
    margin-top: var(--sp-20);
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--sp-12);
    margin-bottom: var(--sp-12);
    padding-bottom: var(--sp-12);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-section {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}

.footer-title {
    font-family: var(--font-serif);
    font-size: var(--text-2xl);
    font-style: italic;
    margin: 0;
}

.footer-description {
    font-size: var(--text-sm);
    color: rgba(255, 255, 255, 0.6);
    margin: 0;
    line-height: 1.7;
}

.footer-heading {
    font-family: var(--font-sans);
    font-size: var(--text-xs);
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0;
}

.footer-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
    font-size: var(--text-sm);
    transition: color var(--duration-fast);
}

.footer-links a:hover {
    color: var(--white);
}

.footer-bottom {
    text-align: center;
}

.footer-bottom p {
    margin: 0;
    color: rgba(255, 255, 255, 0.4);
    font-size: var(--text-sm);
}

/* ===========================
   Image Upload & Preview
   =========================== */
#image-preview {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--sp-3);
    margin-top: var(--sp-4);
}

.image-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    cursor: grab;
    border: 1px solid var(--cloud);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sortable-ghost {
    opacity: 0.3;
}

.sortable-chosen {
    cursor: grabbing !important;
}

.sortable-drag {
    opacity: 0.9;
    transform: rotate(2deg);
    box-shadow: var(--shadow-xl);
}

/* ===========================
   Utility Classes
   =========================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-1 { margin-top: var(--sp-2); }
.mt-2 { margin-top: var(--sp-4); }
.mt-3 { margin-top: var(--sp-6); }
.mt-4 { margin-top: var(--sp-8); }

.mb-1 { margin-bottom: var(--sp-2); }
.mb-2 { margin-bottom: var(--sp-4); }
.mb-3 { margin-bottom: var(--sp-6); }
.mb-4 { margin-bottom: var(--sp-8); }

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 1024px) {
    :root {
        --text-5xl: 2.5rem;
        --text-4xl: 2rem;
        --text-3xl: 1.75rem;
    }
}

@media (max-width: 768px) {
    .navbar .container {
        flex-wrap: wrap;
        gap: var(--sp-4);
    }

    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--sp-4);
    }

    .posts-grid {
        grid-template-columns: 1fr;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: var(--sp-8);
    }

    :root {
        --text-5xl: 2rem;
        --text-4xl: 1.75rem;
        --text-3xl: 1.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 var(--sp-4);
    }

    main {
        padding: var(--sp-6) 0;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }
}

/* ===========================
   Page Animations
   =========================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn var(--duration-slow) var(--ease-out);
}

/* Staggered animations for lists */
.stagger-1 { animation-delay: 50ms; }
.stagger-2 { animation-delay: 100ms; }
.stagger-3 { animation-delay: 150ms; }
.stagger-4 { animation-delay: 200ms; }
