/* ==============================
  File: styles.css
  Author: Sorta Savage
 * ============================== */

/* ==============================
 * Variables
 * ============================== */

:root {
    --font-family: system-ui, sans-serif;
    --border-radius: 8px;
    --box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition-speed: 0.3s;
    --surface-gradient: linear-gradient(135deg, var(--surface-color) 0%, #2d2d2d 100%);

    /* Colors */
    --background-color: #0a0a0a;
    --surface-color: #1a1a1a;
    --surface-color-alt: #242424;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --primary-color: #e63946;
    --primary-dark-20: #b82d38;
    --button-gray: #808080;
    --table-border: rgba(255, 255, 255, 0.12);
    --table-hover: rgba(255, 255, 255, 0.06);
}

/* ==============================
 * Base Styles
 * ============================== */

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ==============================
 * Typography
 * ============================== */

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family);
    line-height: 1.2;
    font-weight: 700;
    color: var(--text-primary);
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
}

p {
    margin-bottom: 1rem;
    line-height: 1.6;
}

a {
    color: var(--text-primary);
    transition: color var(--transition-speed);
}

a:hover {
    color: var(--text-secondary);
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ==============================
 * Card Styles
 * ============================== */

.card_signature {
    position: relative;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.card_signature::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary-color), #4cc9f0);
}

/* ==============================
 * Header and Navigation
 * ============================== */

header {
    width: 100%;
    margin: 0 auto;
    top: 0;
    z-index: 100;
    background: var(--surface-gradient);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.header_container {
    margin: 0 auto;
    width: 100%;
}

.nav_bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 4.5rem;
    padding: 0 1.5rem;
    width: 100%;
    gap: 1rem;
}

/* Logo */
.logo_link {
    display: flex;
    align-items: center;
}

.logo {
    width: 3rem;
    height: 3rem;
    transition: transform var(--transition-speed);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.logo_link:hover .logo {
    transform: scale(1.05);
}

/* Search Box */
.search_box {
    flex: 1;
    max-width: 600px;
}

#search_form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    transition: background var(--transition-speed);
}

#search_form:focus-within {
    background: rgba(255, 255, 255, 0.1);
}

#player_search {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
}

#player_search::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

#search_form input[type="submit"] {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: calc(var(--border-radius) - 2px);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background var(--transition-speed);
    text-transform: uppercase;
}

#search_form input[type="submit"]:hover {
    background: var(--primary-dark-20);
}

/* ==============================
 * SPA View Management
 * ============================== */

.view {
    display: none;
}

.view.active {
    display: block;
}

/* ==============================
 * Leaderboard Header
 * ============================== */

.leaderboard_header {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.last_updated {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

/* ==============================
 * Player Profile
 * ============================== */


.player_header {
    margin: 1rem 0;
}

.player_info_container {
    background: var(--surface-gradient);
    border-radius: 0;
    padding: 2rem;
    box-shadow: var(--box-shadow);
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    max-width: 800px;
    margin: 0 auto;
}

.player_avatar {
    width: 90px;
    height: 90px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    margin-right: 2rem;
    flex-shrink: 0;
}

.player_details {
    flex: 1;
}

.player_name {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
}

.rank {
    font-size: small;
}

.player_stats {
    text-align: start;
}

.player_stats_container {
    width: 100%;
    height: 100%;
}

.stat {
    margin-bottom: 0.5rem;
}

.stat_label,
.stat_value {
    color: var(--text-primary);
}

/* Prompts */
.player_info_prompt,
.leaderboard_prompt,
.skills_prompt,
.activities_prompt {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    text-align: center;
}

.prompt_content,
.prompt_message {
    color: var(--text-secondary);
}

/* ==============================
 * Table Styles
 * ============================== */

.table_container {
    background-color: var(--surface-color);
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0;
}

.data_table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-primary);
    font-size: 0.95rem;
    margin: 0;
}

th {
    background-color: var(--surface-color-alt);
    color: var(--text-primary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    padding: 1.25rem 1rem;
    text-align: center;
    border-bottom: 2px solid var(--table-border);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

th:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--table-border);
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    text-align: center;
}

td:last-child {
    border-right: none;
}

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

tr {
    transition: background-color var(--transition-speed), transform var(--transition-speed);
}

tr:hover td {
    background-color: var(--table-hover);
}


/* ==============================
 * Leaderboard Specific
 * ============================== */

.leaderboard_container {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    padding: 0;
    max-width: 800px;
    margin: 0 auto 1rem auto;
}

.rank-cell {
    font-weight: 700;
    text-align: center;
    min-width: 60px;
}

.name-cell {
    font-weight: 600;
    min-width: 120px;
    text-align: center;
}

.level-cell {
    text-align: center;
    font-weight: 500;
    min-width: 100px;
}

.experience-formatted-cell {
    text-align: center;
    font-weight: 500;
    min-width: 80px;
}

.max-player-row {
    background: #065106;
}

/* ==============================
 * Tabs
 * ============================== */

.tabs_container {
    box-shadow: var(--box-shadow);
    overflow: hidden;
    max-width: 800px;
    margin: 0 auto 1rem auto;
}

.tabs {
    display: flex;
    background-color: var(--surface-color);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    gap: 0;
}

.tabs::-webkit-scrollbar {
    display: none;
}

.tab_button {
    flex: 1;
    padding: 1rem 1.5rem;
    background-color: transparent;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: color var(--transition-speed), background-color var(--transition-speed);
    position: relative;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.tab_button:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.03);
}

.tab_button.active {
    color: var(--primary-color);
}

.tab_button.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary-color);
}

.tab_content {
    display: none;
}

.tab_content.active {
    display: block;
}

/* ==============================
 * Player Lookup - Category Rows
 * ============================== */

tr[class$="-row"] {
    border-left: 3px solid var(--category-color);
}

tr.combat-row {
    --category-color: var(--primary-color);
}

tr.skilling-row {
    --category-color: var(--button-gray);
}

tr.achievement-row {
    --category-color: #4cc9f0;
}

tr.activity-row {
    --category-color: #28a745;
}

/* ==============================
 * Footer
 * ============================== */

footer {
    margin: 0 auto;
    background-color: var(--surface-color);
    border-radius: 0;
    padding: 1rem 0;
    width: 100%;
    position: relative;
}

.footer_bottom {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.madeby {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
}

.madeby a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    transition: color var(--transition-speed);
    border-bottom: 2px solid transparent;
}

.madeby a:hover {
    color: var(--primary-dark-20);
    border-bottom-color: var(--primary-dark-20);
}

.copyright_disclaimer {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    margin: 1rem auto;
    padding: 1rem 0;
    line-height: 1.6;
    max-width: 600px;
    width: 100%;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
}

/* ==============================
 * Media Queries
 * ============================== */

@media (max-width: 1024px) {
    .container {
        padding: 0 1.5rem;
    }

    h1 {
        font-size: 2.25rem;
    }

    h2 {
        font-size: 1.75rem;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.6rem;
    }

    .tab_button {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
        flex: 1;
        min-width: 0;
    }

    .player_info_container {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .player_avatar {
        margin-right: 0;
        margin-bottom: 1.5rem;
    }

    .player_name {
        justify-content: center;
        flex-wrap: wrap;
    }

    .footer_bottom {
        flex-direction: column;
        gap: 1.5rem;
    }

    th {
        padding: 1rem 0.75rem;
        font-size: 0.8rem;
    }

    td {
        padding: 0.875rem 0.75rem;
        font-size: 0.9rem;
    }
}

/* Mobile - Search & Navigation */
@media (max-width: 500px) {
    header {
        position: relative;
    }

    .nav_bar {
        transform-origin: center top;
        height: auto;
        padding: .5rem;
    }

    .logo_link {
        align-self: flex-start;
    }

    .logo {
        width: 2.5rem;
        height: 2.5rem;
        transform: scale(0.95);

    }

    .search_box {
        width: 100%;
        max-width: none;
        transform: scale(0.95);
    }

    #search_form {
        padding: 0.2rem;
    }

    #player_search {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }

    #search_form input[type="submit"] {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
    }

    footer {
        padding: 1.5rem 0 1rem;
    }

    .footer_bottom {
        padding: 0 1.5rem;
    }

    .madeby {
        font-size: 0.9rem;
        text-align: center;
        width: 100%;
    }

    .copyright_disclaimer {
        font-size: 0.7rem;
        padding: 0.75rem 1.5rem 0;
        margin-top: 1rem;
    }
}

@media (max-width: 400px) {

    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    th {
        padding: 0.75rem 0.5rem;
        font-size: 0.75rem;
    }

    td {
        padding: 0.75rem 0.5rem;
        font-size: 0.85rem;
    }

    .data_table {
        min-width: 100%;
    }

    .tabs {
        margin: 0 1rem;
    }

    .tab_button {
        padding: 0.75rem 0.25rem;
        font-size: 0.8rem;
        letter-spacing: 0.02em;
    }

    .logo {
        width: 2.5rem;
        height: 2.5rem;
        transform: scale(0.75);

    }

    .search_box {
        width: 100%;
        max-width: none;
        transform: scale(0.65);

    }

}