:root {
    --blue-900: #0c2340;
    --blue-800: #133a5e;
    --blue-700: #1a4f7f;
    --blue-600: #2368a2;
    --blue-500: #2c82c9;
    --blue-400: #5ba4d9;
    --blue-300: #8dc3e8;
    --blue-200: #bddcf2;
    --blue-100: #e1eef8;
    --blue-50: #f0f5fb;
    --accent: #3b8dd4;
    --accent-hover: #2a7bc1;
    --text-primary: #1e2a3a;
    --text-secondary: #5a6f85;
    --card-bg: #ffffff;
    --body-bg: #e8eef5;
    --shadow-sm: 0 1px 3px rgba(12, 35, 64, 0.08);
    --shadow-md: 0 4px 12px rgba(12, 35, 64, 0.1);
    --shadow-lg: 0 8px 24px rgba(12, 35, 64, 0.12);
    --radius: 10px;
    --radius-lg: 14px;
}

html {
    font-size: 15px;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: var(--body-bg);
    color: var(--text-primary);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

main {
    flex: 1;
}

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

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

/* Navbar */
.navbar-main {
    background: linear-gradient(135deg, var(--blue-900) 0%, var(--blue-800) 100%);
    border-bottom: 3px solid var(--blue-500);
    padding: 0.6rem 0;
}

.navbar-main .navbar-brand {
    font-weight: 700;
    font-size: 1.2rem;
    letter-spacing: 0.3px;
    color: #fff !important;
}

.navbar-main .navbar-brand i {
    color: var(--blue-300);
}

.navbar-main .nav-link {
    color: var(--blue-200) !important;
    font-weight: 500;
    transition: color 0.2s;
}

.navbar-main .nav-link:hover,
.navbar-main .nav-link:focus {
    color: #fff !important;
}

/* Hero search */
.hero-search {
    background: linear-gradient(160deg, var(--blue-800) 0%, var(--blue-700) 40%, var(--blue-600) 100%);
    border-radius: var(--radius-lg);
    padding: 3rem 2rem;
    color: white;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.hero-search::before {
    content: '';
    position: absolute;
    top: -40%;
    right: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
    border-radius: 50%;
}

.hero-search h1 {
    font-weight: 700;
    font-size: 1.8rem;
    position: relative;
}

.hero-search .lead {
    color: var(--blue-200);
    position: relative;
}

.hero-search .form-control {
    font-size: 1.15rem;
    padding: 0.7rem 1rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    border: 2px solid transparent;
    border-radius: var(--radius);
    background: rgba(255,255,255,0.95);
    transition: border-color 0.2s;
}

.hero-search .form-control:focus {
    border-color: var(--blue-400);
    box-shadow: 0 0 0 3px rgba(44, 130, 201, 0.25);
}

.hero-search .btn-search {
    font-size: 1.05rem;
    padding: 0.7rem 1.8rem;
    font-weight: 600;
    background: linear-gradient(135deg, #f0a500, #e09200);
    border: none;
    color: var(--blue-900);
    border-radius: var(--radius);
    transition: transform 0.15s, box-shadow 0.15s;
}

.hero-search .btn-search:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(240, 165, 0, 0.4);
    background: linear-gradient(135deg, #f5b420, #e09200);
    color: var(--blue-900);
}

/* Cards */
.card {
    border: none;
    border-radius: var(--radius);
    background: var(--card-bg);
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card-header {
    background: var(--blue-50) !important;
    border-bottom: 1px solid var(--blue-100);
    border-radius: var(--radius) var(--radius) 0 0 !important;
}

.card-header h5 {
    color: var(--blue-800);
    font-weight: 600;
}

/* Plate cards */
.plate-card {
    cursor: pointer;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border-left: 4px solid var(--blue-300);
}

.plate-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-left-color: var(--accent);
}

.plate-card .card-body {
    padding: 1rem 1.25rem;
}

.plate-card-stats .badge {
    font-size: 0.82rem;
}

.plate-svg {
    width: 180px;
    min-width: 180px;
    overflow: hidden;
}

.plate-svg svg {
    width: 100%;
    height: auto;
    display: block;
}

/* Rating */
.rating-positive {
    color: #1a9a5b;
}

.rating-negative {
    color: #d64045;
}

.rating-neutral {
    color: var(--text-secondary);
}

.rating-score {
    font-size: 3rem;
    font-weight: 800;
    min-width: 100px;
    display: inline-block;
}

.plate-display {
    max-width: 500px;
    margin: 0 auto;
}

/* Vote buttons */
.vote-btn {
    width: 130px;
    font-size: 1rem;
    padding: 0.55rem 1rem;
    font-weight: 600;
    border-radius: var(--radius);
    border-width: 2px;
    transition: transform 0.15s, box-shadow 0.15s;
}

.vote-btn:hover {
    transform: translateY(-2px);
}

.btn-outline-success.vote-btn {
    border-color: #1a9a5b;
    color: #1a9a5b;
}

.btn-outline-success.vote-btn:hover,
.btn-success.vote-btn {
    background: #1a9a5b;
    border-color: #1a9a5b;
    color: #fff;
    box-shadow: 0 4px 12px rgba(26, 154, 91, 0.3);
}

.btn-outline-danger.vote-btn {
    border-color: #d64045;
    color: #d64045;
}

.btn-outline-danger.vote-btn:hover,
.btn-danger.vote-btn {
    background: #d64045;
    border-color: #d64045;
    color: #fff;
    box-shadow: 0 4px 12px rgba(214, 64, 69, 0.3);
}

/* Comments */
.comment-item {
    border-left: 3px solid var(--blue-200);
    padding: 0.75rem 0 0.75rem 1rem;
    margin-bottom: 1rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--blue-50);
    transition: border-color 0.2s;
}

.comment-item:hover {
    border-left-color: var(--accent);
}

.comment-author {
    font-weight: 600;
    color: var(--blue-800);
}

.comment-date {
    font-size: 0.82rem;
    color: var(--text-secondary);
}

/* Photo carousel */
.carousel-inner.rounded {
    border-radius: var(--radius);
    overflow: hidden;
}

.carousel-photo {
    object-fit: contain;
    max-height: 400px;
    background: var(--blue-900);
}

.carousel-caption-custom {
    background: rgba(12, 35, 64, 0.75);
    padding: 0.4rem 0.75rem;
    border-radius: 0 0 var(--radius) var(--radius);
    color: var(--blue-100);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.carousel-thumb {
    width: 64px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid transparent;
    opacity: 0.6;
    transition: opacity 0.2s, border-color 0.2s;
    cursor: pointer;
}

.carousel-thumb:hover,
.carousel-thumb.active {
    opacity: 1;
    border-color: var(--accent);
}

.carousel-control-prev-icon,
.carousel-control-next-icon {
    background-color: rgba(12, 35, 64, 0.6);
    border-radius: 50%;
    padding: 1rem;
}

/* Fullscreen toggle */
.carousel-fullscreen-wrap {
    position: relative;
}

.carousel-fullscreen-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 10;
    background: rgba(12, 35, 64, 0.6);
    border: none;
    color: #fff;
    border-radius: 6px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.carousel-fullscreen-btn:hover {
    background: rgba(12, 35, 64, 0.85);
}

.carousel-is-fullscreen {
    background: #000;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.carousel-is-fullscreen .carousel-photo {
    max-height: 100vh;
    object-fit: contain;
}

/* Section headers */
.section-header {
    border-bottom: 2px solid var(--blue-200);
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    color: var(--blue-800);
    font-weight: 600;
}

/* Badges */
.badge {
    font-weight: 600;
    border-radius: 6px;
    padding: 0.4em 0.65em;
}

/* Breadcrumb */
.breadcrumb {
    background: var(--card-bg);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    font-size: 0.9rem;
}

.breadcrumb-item a {
    color: var(--accent);
    text-decoration: none;
}

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

/* Forms */
.form-control {
    border-radius: 8px;
    border: 1.5px solid var(--blue-200);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(44, 130, 201, 0.15);
}

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    border-radius: 8px;
    font-weight: 600;
    transition: background 0.2s, transform 0.15s;
}

.btn-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: translateY(-1px);
}

/* Footer */
.footer-main {
    background: linear-gradient(135deg, var(--blue-900) 0%, var(--blue-800) 100%);
    border-top: 3px solid var(--blue-500);
    margin-top: auto;
    color: var(--blue-200);
}

.footer-main h6 {
    color: #fff;
    font-weight: 600;
}

.footer-main .text-secondary {
    color: var(--blue-300) !important;
}

/* Misc */
/* Keep the placeholder transparent in floating-label inputs (Bootstrap's
   default). The visible text at rest is the <label>, which floats up on
   focus; a coloured placeholder here would render on TOP of the resting
   label and the two would overlap. */
.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: transparent;
}

.input-group-text {
    background: var(--blue-50);
    border: 1.5px solid var(--blue-200);
    color: var(--text-secondary);
}

.alert-danger {
    background: #fdecea;
    border-color: #f5c6cb;
    color: #8b2025;
    border-radius: 8px;
}

/* Empty state icon */
.empty-state {
    padding: 2.5rem 1rem;
}

.empty-state i {
    color: var(--blue-300);
}

.empty-state p {
    color: var(--text-secondary);
}

/* Sort bar */
.sort-bar .sort-btn {
    border-radius: 20px;
    font-size: 0.78rem;
    padding: 0.25rem 0.7rem;
    font-weight: 600;
    transition: all 0.2s;
}

.sort-bar .btn-outline-secondary {
    border-color: var(--blue-200);
    color: var(--text-secondary);
}

.sort-bar .btn-outline-secondary:hover {
    background: var(--blue-100);
    border-color: var(--accent);
    color: var(--accent);
}

/* Pagination */
.pagination .page-link {
    color: var(--accent);
    border: 1.5px solid var(--blue-200);
    border-radius: 8px !important;
    margin: 0 2px;
    font-weight: 600;
    min-width: 38px;
    text-align: center;
    transition: all 0.2s;
}

.pagination .page-link:hover {
    background: var(--blue-100);
    border-color: var(--accent);
    color: var(--accent-hover);
}

.pagination .page-item.active .page-link {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(44, 130, 201, 0.3);
}

.pagination .page-item.disabled .page-link {
    color: var(--blue-300);
    border-color: var(--blue-100);
    background: var(--blue-50);
}

/* Rankings leaderboard */
.ranking-list .list-group-item {
    align-items: center;
}

.ranking-top-comment {
    font-size: 0.82rem;
    color: var(--text-secondary);
    border-top: 1px dashed var(--blue-200);
    padding-top: 0.4rem;
    line-height: 1.4;
}

.ranking-top-comment .bi-chat-quote {
    color: var(--blue-400);
}

.comment-author-inline {
    font-weight: 600;
    color: var(--blue-800);
}

.comment-score-badge {
    font-size: 0.75rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.ranking-plate svg {
    width: 100%;
    height: auto;
    max-width: 240px;
    display: block;
}

/* Panel nav */
.nav-pills .nav-link {
    color: var(--blue-800);
    border-radius: 8px;
    font-size: 0.9rem;
    padding: 0.45rem 0.75rem;
    transition: background 0.2s, color 0.2s;
}

.nav-pills .nav-link:hover {
    background: var(--blue-100);
    color: var(--accent);
}

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

/* AI comment autocomplete: grey ghost text behind the comment textarea */
.ac-wrap { position: relative; }
.ac-wrap textarea { position: relative; background: transparent; z-index: 1; }
/* Bootstrap's .form-control:focus (0,2,0) sets an opaque background that would hide
   the ghost while typing; this focus rule (0,2,1) outranks it so the textarea stays
   transparent and the grey suggestion behind it remains visible. */
.ac-wrap textarea:focus { background: transparent; }
.ac-ghost {
    position: absolute; inset: 0;
    margin: 0; overflow: hidden;
    pointer-events: none; z-index: 0;
    color: transparent;
    white-space: pre-wrap; word-wrap: break-word;
}
.ac-ghost .ac-ghost-text { color: #9aa3b2; }
