/* =========================================================================
   TenVet — Modern UI Layer (modern.css)
   -------------------------------------------------------------------------
   A non-destructive enhancement layer loaded AFTER tooplate-style.css.
   Goals: modern look & feel, same tech stack (Bootstrap 4 + jQuery),
   same functionality, SAME color scheme, optimized for readability and
   usability for older users (larger text, clear focus, bigger tap targets).
   No existing rules are removed — this file only refines/overrides.
   ========================================================================= */

/* -------------------------------------------------------------------------
   1. Design tokens (existing palette, centralized)
   ------------------------------------------------------------------------- */
:root {
    --tvs-green:        #57a13d;   /* primary */
    --tvs-green-hover:  #489a2a;   /* primary hover */
    --tvs-green-dark:   #3c702c;
    --tvs-green-darker: #21600a;
    --tvs-red:          #951b27;   /* secondary / accent */
    --tvs-navy:         #1f3646;   /* footer / dark surfaces */
    --tvs-gray:         #f4f4f4;   /* light surface */

    --tvs-lime:         #c8f03c;   /* electric accent (shared with redesign) */
    --tvs-forest:       #0e2a1e;   /* deep forest ink */

    --tvs-ink:          #2b2b2b;   /* main readable text */
    --tvs-ink-soft:     #555555;   /* secondary text (AA contrast) */
    --tvs-border:       #e2e6e1;

    --tvs-radius:       12px;
    --tvs-radius-sm:    8px;
    --tvs-radius-pill:  999px;

    --tvs-shadow-sm:  0 2px 6px rgba(31, 54, 70, 0.08);
    --tvs-shadow:     0 6px 20px rgba(31, 54, 70, 0.10);
    --tvs-shadow-lg:  0 14px 40px rgba(31, 54, 70, 0.16);

    --tvs-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* -------------------------------------------------------------------------
   2. Typography & readability (larger, higher contrast)
   ------------------------------------------------------------------------- */
html { scroll-behavior: smooth; }

body {
    font-size: 17px;          /* up from 13px — key readability win */
    line-height: 1.7;
    color: var(--tvs-ink);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

p {
    color: var(--tvs-ink-soft);   /* darker than the old #898989 for contrast */
    line-height: 1.8;
    font-size: 1.02rem;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--tvs-ink);
    line-height: 1.25;
    letter-spacing: -0.01em;
}

a { color: var(--tvs-green-dark); }
a:hover, a:focus { color: var(--tvs-green); }

/* Comfortable reading size inside content cards */
.tm-media-body-1,
.media-body { font-size: 1.03rem; }

/* -------------------------------------------------------------------------
   3. Accessibility — clear keyboard focus for older / assistive users
   ------------------------------------------------------------------------- */
a:focus-visible,
button:focus-visible,
.btn:focus-visible,
.nav-link:focus-visible,
.dropdown-item:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid var(--tvs-green);
    outline-offset: 2px;
    border-radius: var(--tvs-radius-sm);
}

/* Respect users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* -------------------------------------------------------------------------
   4. Navigation — clean white bar, pill links, accent hover
   ------------------------------------------------------------------------- */
.tm-top-bar {
    background: #ffffff;
    box-shadow: 0 2px 16px rgba(31, 54, 70, 0.09);
}

/* On large screens Bootstrap caps .container at 1140px, which crams the brand
   and the full menu together. Give the top bar a wider, fluid container. */
.tm-top-bar > .container {
    max-width: 1440px;
    width: 94%;
}
/* Vertically centre brand + menu within the bar. */
.tm-top-bar .navbar { align-items: center; }

.navbar-brand {
    letter-spacing: -0.01em;
    white-space: nowrap;
    padding-right: 1.5rem;
    display: flex;
    align-items: center;
}
.navbar-brand img { margin-right: 8px; }

/* Clean pill links: no dividers, one line each, soft lime accent on hover. */
.nav-item {
    background: transparent !important;
    border: none !important;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0 !important;
}
.tm-top-bar .navbar-expand-lg .navbar-nav .nav-link,
.tm-top-bar.active .navbar-expand-lg .navbar-nav .nav-link {
    padding: 11px 17px !important;
    margin: 0 2px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #17311f;
    white-space: nowrap;
    border-radius: var(--tvs-radius-pill);
    display: flex;
    align-items: center;
    transition: background 0.2s var(--tvs-ease), color 0.2s var(--tvs-ease);
}
.nav-link.active,
.nav-link:hover {
    background: var(--tvs-lime) !important;
    color: var(--tvs-forest) !important;
}

/* Dropdowns: softer, roomier, easier to hit */
.dropdown-menu {
    border: 1px solid var(--tvs-border);
    border-radius: var(--tvs-radius-sm);
    box-shadow: var(--tvs-shadow);
    padding: 6px;
    overflow: hidden;
    margin-top: 6px;
}
.dropdown-item {
    font-size: 0.98rem;
    padding: 10px 14px;
    border-radius: var(--tvs-radius-sm);
    white-space: normal;
    font-weight: 500;
}
.dropdown-item:hover { background-color: var(--tvs-lime); color: var(--tvs-forest); }

/* The accent line is relative-positioned and flows after the (shorter) nav
   content, leaving a white gap beneath it before the bottom of the fixed bar.
   Anchor it to the bar's bottom edge so it sits flush with no gap below. */
#grnln {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    margin: 0;
}

/* -------------------------------------------------------------------------
   5. Buttons — rounded, larger tap targets, smooth interaction
   ------------------------------------------------------------------------- */
.btn {
    border-radius: var(--tvs-radius-sm);
    font-weight: 600;
    transition: transform 0.15s var(--tvs-ease), box-shadow 0.2s var(--tvs-ease),
                background-color 0.2s var(--tvs-ease), border-color 0.2s var(--tvs-ease);
}

.btn-primary {
    background-color: var(--tvs-green);
    border-color: var(--tvs-green);
    border-radius: var(--tvs-radius-sm);
    font-size: 0.95rem;
    padding: 12px 26px;
    box-shadow: var(--tvs-shadow-sm);
}
.btn-primary:hover,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--tvs-green-hover);
    border-color: var(--tvs-green-darker);
    transform: translateY(-1px);
    box-shadow: var(--tvs-shadow);
}

/* Bordered CTA buttons — rounder, larger, clearer */
.tm-btn-white-bordered,
.tm-btn-green-bordered {
    border-radius: var(--tvs-radius-pill);
    padding: 12px 30px;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.02em;
}
.tm-btn-white-bordered:hover,
.tm-btn-white-bordered:focus { color: var(--tvs-green); background: #fff; }
.tm-btn-green-bordered:hover,
.tm-btn-green-bordered:focus { color: #fff; background: var(--tvs-green-darker); }

/* -------------------------------------------------------------------------
   6. Forms — larger, rounded, obvious focus (great for older users)
   ------------------------------------------------------------------------- */
.form-control,
.tm-select {
    border-radius: var(--tvs-radius-sm);
    font-size: 1rem;
    padding: 0.7rem 0.9rem;
    border: 1px solid #cfd6cd;
}
.form-control:focus {
    border-color: var(--tvs-green);
    box-shadow: 0 0 0 0.2rem rgba(87, 161, 61, 0.25);
}
label { font-weight: 600; color: var(--tvs-ink); }

/* -------------------------------------------------------------------------
   7. Cards / articles / surfaces — rounded, soft shadows, gentle hover
   ------------------------------------------------------------------------- */
.tm-bg-white-shadow {
    border-radius: var(--tvs-radius);
    box-shadow: var(--tvs-shadow) !important;
}

.tm-article {
    border-radius: var(--tvs-radius);
}
.tm-article:hover {
    box-shadow: var(--tvs-shadow-lg) !important;
    transform: translateY(-6px);   /* replaces the abrupt scale(1.1) */
}

.tm-media-container { border-radius: var(--tvs-radius); }

/* News / tournament item cards inside the scroll containers */
.tm-media-1 {
    background: #fff;
    border: 1px solid var(--tvs-border);
    border-radius: var(--tvs-radius-sm);
    padding: 16px 18px;
    transition: box-shadow 0.2s var(--tvs-ease), transform 0.2s var(--tvs-ease);
}
.tm-media-1:hover {
    box-shadow: var(--tvs-shadow-sm);
    transform: translateY(-2px);
}

/* Nicer, thinner divider than the heavy green bar between items */
.green-line { border-radius: var(--tvs-radius-pill); }

/* Custom scrollbars for the scroll containers */
.scroll-container { scrollbar-width: thin; scrollbar-color: var(--tvs-green) #e9ede8; }
.scroll-container::-webkit-scrollbar { width: 10px; }
.scroll-container::-webkit-scrollbar-track { background: #e9ede8; border-radius: 999px; }
.scroll-container::-webkit-scrollbar-thumb { background: var(--tvs-green); border-radius: 999px; }

/* -------------------------------------------------------------------------
   8. Section headings — a touch more polish
   ------------------------------------------------------------------------- */
.tm-section-title,
.tm-section-title-2 { font-weight: 700; letter-spacing: -0.02em; }
.tm-article-title-1 { font-weight: 700; }

/* -------------------------------------------------------------------------
   9. Footer — modern, readable
   ------------------------------------------------------------------------- */
.tm-bg-dark-blue { background: var(--tvs-navy); }
footer p { color: rgba(255, 255, 255, 0.85); font-size: 1rem; }

/* Sticky footer: on short pages the footer should sit at the bottom of the
   viewport, not float up leaving empty space beneath it. */
body { display: flex; flex-direction: column; min-height: 100vh; padding-top: 99px; }
body > footer,
body > div:has(> footer.tm-bg-dark-blue) { margin-top: auto; }

/* -------------------------------------------------------------------------
   10. Tables — readable striped rows (used across many pages)
   ------------------------------------------------------------------------- */
.table { font-size: 1rem; }
.table thead th {
    background: var(--tvs-green);
    color: #fff;
    border: none;
    font-weight: 600;
}
.table td, .table th { vertical-align: middle; }

/* -------------------------------------------------------------------------
   10b. Responsiveness — images never overflow; wide tables scroll on phones
   ------------------------------------------------------------------------- */
img { max-width: 100%; }

@media screen and (max-width: 767px) {
    /* Fallback so wide data tables become horizontally scrollable on phones
       instead of breaking the layout. Applies to plain Bootstrap tables that
       are not already wrapped in .table-responsive. */
    table.table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Tables already wrapped in .table-responsive keep normal table layout — the
   wrapper owns the horizontal scrolling (higher specificity wins over above). */
.table-responsive > table.table,
.table-responsive table.table { display: table; }

/* -------------------------------------------------------------------------
   11. Mobile off-canvas nav — bigger, easier to tap
   ------------------------------------------------------------------------- */
@media screen and (max-width: 991px) {
    .navbar-collapse {
        width: 280px;
        top: 65px;                     /* start just below the fixed top bar */
        height: calc(100vh - 65px);    /* fill the rest of the screen, no overlap */
        overflow-y: auto;
        border-top: 1px solid var(--tvs-border);
        box-shadow: -4px 8px 18px rgba(31, 54, 70, 0.15);
    }
    .tm-top-bar .navbar-expand-lg .navbar-nav .nav-link,
    .tm-top-bar.active .navbar-expand-lg .navbar-nav .nav-link {
        padding: 14px 16px;
        font-size: 1.05rem;
    }
    .nav-item { border-left: none; border-bottom: 1px solid var(--tvs-border); }
    .nav-item:last-child { border-right: none; }
    .dropdown-item { font-size: 1.02rem; padding: 12px 14px; }
}

/* -------------------------------------------------------------------------
   12. Phone refinements (usability & visibility on small screens)
   ------------------------------------------------------------------------- */
@media screen and (max-width: 767px) {
    /* The hero band is purely decorative/empty; shrink it so phones don't
       scroll through a tall empty block before reaching the content. */
    #tm-section-1 {
        height: 220px !important;
        min-height: 220px !important;
    }

    /* Tighter section padding so content isn't buried in whitespace. */
    .tm-section-pad { padding: 40px 16px; }

    /* Comfortable tap targets for primary actions. */
    .btn { padding-top: 12px; padding-bottom: 12px; }

    /* Keep big display titles from overflowing narrow screens. */
    .tm-section-title { font-size: 2.2rem; }
    .tm-section-title-2 { font-size: 2rem; }
    .tm-section-subtitle-2 { font-size: 1.3rem; }
}

/* -------------------------------------------------------------------------
   13. Very narrow phones (<460px): shrink the brand so the menu button
       (hamburger/"ellipsis") stays on the same row and never wraps below.
   ------------------------------------------------------------------------- */
@media screen and (max-width: 459px) {
    .navbar-brand {
        font-size: 15px !important;   /* overrides the inline 20px */
        padding-right: 0;
        white-space: nowrap;
    }
    .navbar-brand img {
        height: 34px;
        margin-right: 5px;
    }
    .navbar { flex-wrap: nowrap; }
}

@media screen and (max-width: 360px) {
    .navbar-brand { font-size: 13px !important; }
    .navbar-brand img { height: 30px; }
}

/* -------------------------------------------------------------------------
   14. Softer, rounder data tables, cards & selects (less "square")
   ------------------------------------------------------------------------- */
/* Round any table wrapped in .table-responsive (clips header + outer corners
   to rounded, while keeping horizontal scrolling on small screens). */
.table-responsive,
.tvs-round-table {
    overflow: hidden;
    overflow-x: auto;
    border-radius: 14px;
    border: 1px solid var(--tvs-border);
    box-shadow: var(--tvs-shadow-sm);
}

/* Soften harsh (often black/thick) header cell dividers used inline. */
.table thead th { border-color: rgba(255, 255, 255, 0.22) !important; }

/* Round Bootstrap cards, images and list groups still using square corners. */
.card { border-radius: var(--tvs-radius) !important; }
/* Only round a card-header when it sits at the very top of the card; otherwise
   (e.g. below a card image) it would create a rounded notch mid-card. */
.card > .card-header:first-child {
    border-top-left-radius: var(--tvs-radius) !important;
    border-top-right-radius: var(--tvs-radius) !important;
}
.card > .card-img-top:first-child {
    border-top-left-radius: var(--tvs-radius) !important;
    border-top-right-radius: var(--tvs-radius) !important;
}
.card > .list-group:last-child .list-group-item:last-child,
.list-group-item:last-child {
    border-bottom-left-radius: var(--tvs-radius);
    border-bottom-right-radius: var(--tvs-radius);
}

/* Round select boxes (tooplate set border-radius: 0). */
.tm-select,
select.form-control { border-radius: var(--tvs-radius-sm) !important; }

/* Rounded ROW cards inside the wrapped data tables (ranking, kalendar,
   turniriClan, versus). Tables must use the separated-borders model so the
   corner cells can be rounded; each cell inherits the row's border colour
   (green/red) from the inline style on the <tr>. */
.table-responsive > table.table,
.tvs-round-table > table.table {
    border-collapse: separate;
    border-spacing: 0;
}
/* Clean, solid header bar (drop the inline black cell dividers). */
.table-responsive .table thead th,
.tvs-round-table .table thead th { border: 0 !important; }

.table-responsive .table tbody tr td,
.tvs-round-table .table tbody tr td {
    border-style: solid;
    border-color: inherit;      /* takes the <tr>'s border colour */
    border-width: 3px 0;        /* top & bottom only by default */
}
.table-responsive .table tbody tr td:first-child,
.tvs-round-table .table tbody tr td:first-child {
    border-left-width: 3px;
    border-top-left-radius: 12px;
    border-bottom-left-radius: 12px;
}
.table-responsive .table tbody tr td:last-child,
.tvs-round-table .table tbody tr td:last-child {
    border-right-width: 3px;
    border-top-right-radius: 12px;
    border-bottom-right-radius: 12px;
}

