/* Guild Global Theme Styles */
/* Component-specific layout styles live in Svelte <style> blocks */

/* Design Tokens */
:root {
    /* Core palette */
    --color-bg-deep: #0f0f23;
    --color-bg-purple: #2d1b69;
    --color-gold: #ffd700;
    --color-gold-dim: rgba(255, 215, 0, 0.3);
    --color-gold-border: rgba(255, 215, 0, 0.5);

    /* Text */
    --color-text-primary: #f0f0f0;
    --color-text-secondary: #e0e0e0;
    --color-text-muted: #d0d0d0;
    --color-text-dim: #c0c0c0;

    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-bg-hover: rgba(255, 255, 255, 0.08);
    --glass-bg-active: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-border-hover: rgba(255, 255, 255, 0.2);
    --glass-border-strong: rgba(255, 255, 255, 0.3);
    --glass-blur: blur(10px);

    /* Modal overlay */
    --modal-bg: rgba(45, 27, 105, 0.95);
    --modal-overlay: rgba(0, 0, 0, 0.5);

    /* Shadows */
    --shadow-text: 1px 1px 2px rgba(0, 0, 0, 0.8);
    --shadow-text-light: 1px 1px 2px rgba(0, 0, 0, 0.6);
    --shadow-text-heavy: 2px 2px 4px rgba(0, 0, 0, 0.8);
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-card-hover: 0 12px 40px rgba(0, 0, 0, 0.5);
    --shadow-photo: 0 4px 12px rgba(0, 0, 0, 0.4);

    /* Borders */
    --radius-sm: 8px;
    --radius-md: 12px;

    /* Transitions */
    --transition-base: all 0.3s ease;
}

/* Top navigation bar */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(45, 27, 105, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0.75rem 2rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    height: 45px;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.top-nav .nav-link {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #e0e0e0;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.top-nav .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    text-decoration: none;
    transform: none;
    box-shadow: none;
}

.top-nav .nav-link.active {
    border-bottom: 2px solid #ffd700;
    padding-bottom: calc(0.5rem - 2px);
}

/* Base guild styling */
.guild-body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    background: linear-gradient(135deg, #2d1b69 0%, #0f0f23 100%);
    font-family: 'Arial', sans-serif;
    color: #e0e0e0;
    line-height: 1.6;
}

.guild-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 5rem 2rem 3rem;
    text-align: center;
}

.full-width-container {
    width: 100%;
    max-width: none;
    margin: 0 auto;
    padding: 5rem 2rem 3rem;
    text-align: center;
}

/* Guild name/title styling */
.guild-name {
    font-size: 3rem;
    font-weight: bold;
    margin-bottom: 2rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    color: #f0f0f0;
    text-align: center;
}

.page-title {
    font-size: 2.5rem;
    font-weight: bold;
    margin-bottom: 3rem;
    text-align: center;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    color: #f0f0f0;
}

/* Guild heraldry/sigil styling */
.heraldry {
    margin: 2rem 0;
}

.heraldry img {
    max-width: 400px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

/* Guild content styling */
.guild-content {
    font-size: 1.2rem;
    color: #d0d0d0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
    margin: 2rem 0;
}

.lore-content {
    font-size: 1.1rem;
    color: #d0d0d0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.6);
}

.lore-content p {
    margin-bottom: 1.5rem;
    text-align: justify;
}

.welcome-content p {
    margin-bottom: 1.5rem;
}

/* Guild greeting styling */
.greeting {
    font-size: 1.5rem;
    font-style: italic;
    margin: 2rem 0;
    color: #c0c0c0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.tagline {
    font-size: 1.2rem;
    margin-top: 1.5rem;
    color: #d0d0d0;
    line-height: 1.6;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

/* Guild navigation styling */
.navigation {
    margin-top: 3rem;
    display: flex;
    gap: 2rem;
    justify-content: center;
    flex-wrap: wrap;
}

.nav-link {
    display: inline-block;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: #e0e0e0;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: bold;
    transition: all 0.3s ease;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    color: #e0e0e0;
    text-decoration: none;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.6);
    color: #ffffff;
}

/* Guild form styling */
.registration-form {
    max-width: 500px;
    margin: 2rem auto;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.form-group {
    margin-bottom: 1.5rem;
    text-align: left;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #f0f0f0;
    font-weight: bold;
    font-size: 1rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
}

.form-input {
    width: 100%;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 1rem;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.4);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.1);
}

.form-input::placeholder {
    color: #a0a0a0;
    opacity: 0.8;
}

.form-submit {
    width: 100%;
    padding: 1.2rem 2rem;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: #e0e0e0;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: bold;
    transition: all 0.3s ease;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    cursor: pointer;
    margin-top: 1rem;
}

.form-submit:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Error and success messaging */
.error-message {
    color: #ff6b6b;
    font-size: 0.9rem;
    margin-top: 0.5rem;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    background: rgba(255, 107, 107, 0.1);
    padding: 0.5rem;
    border-radius: 4px;
    border-left: 3px solid #ff6b6b;
}

.general-error {
    margin: 1rem auto;
    max-width: 500px;
    font-size: 1rem;
    padding: 1rem;
    text-align: center;
    background: rgba(255, 107, 107, 0.15);
    border: 2px solid rgba(255, 107, 107, 0.3);
    border-radius: 8px;
}

.success-greeting {
    color: #6bcf7f;
    font-weight: bold;
}

.inviter-highlight {
    color: #f0f0f0;
    font-weight: bold;
    font-size: 1.3rem;
}

/* Role Squircles */
.member-roles {
    margin-bottom: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.role-squircle {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #000;
    text-shadow: none;
    line-height: 1;
}

/* Themed Tables (Bootstrap overrides for dark theme) */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--color-text-secondary);
    --bs-table-striped-bg: rgba(255, 255, 255, 0.03);
    --bs-table-striped-color: var(--color-text-secondary);
    --bs-table-hover-bg: rgba(255, 255, 255, 0.06);
    --bs-table-hover-color: var(--color-text-primary);
    --bs-table-border-color: var(--glass-border);
    border-color: var(--glass-border);
}

.table thead th {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-text-primary);
    font-weight: 600;
    text-shadow: var(--shadow-text);
    border-bottom: 2px solid var(--color-gold-dim);
}

.table td {
    border-color: var(--glass-border);
}

.table td a {
    color: var(--color-gold);
    text-decoration: none;
    transition: var(--transition-base);
}

.table td a:hover {
    color: #fff;
    text-decoration: underline;
}

/* Themed buttons (Bootstrap overrides for dark theme) */
.btn-outline-secondary {
    color: var(--color-text-secondary);
    border-color: var(--glass-border-strong);
}

.btn-outline-secondary:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    color: var(--color-text-primary);
}

/* Geopo Index Cards */
.geopo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
    text-align: left;
}

.geopo-card {
    display: block;
    padding: 1.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-card);
    text-decoration: none;
    transition: var(--transition-base);
}

.geopo-card:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
    text-decoration: none;
}

.geopo-card h5 {
    color: var(--color-text-primary);
    font-weight: bold;
    margin-bottom: 0.5rem;
    text-shadow: var(--shadow-text);
}

.geopo-card p {
    color: var(--color-text-muted);
    margin: 0;
    font-size: 0.95rem;
    text-shadow: var(--shadow-text-light);
}

.guild-detail-title {
    margin-bottom: 0.5rem;
}

.guild-identity {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
}

.guild-detail-logo {
    max-width: 160px;
    max-height: 160px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

/* Guild Detail Header */
.guild-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    margin-bottom: 2rem;
}

.guild-stats {
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: 1rem 2rem;
    padding: 1.25rem 1.5rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-card);
    flex-shrink: 0;
}

.guild-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.guild-stat-value {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--color-text-primary);
    text-shadow: var(--shadow-text);
}

.guild-stat-label {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Guild Notes (collapsible) */
.guild-notes {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    backdrop-filter: var(--glass-blur);
}

.guild-notes summary {
    padding: 1rem 1.5rem;
    cursor: pointer;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--color-gold);
    text-shadow: var(--shadow-text);
    list-style: none;
}

.guild-notes summary::-webkit-details-marker {
    display: none;
}

.guild-notes summary::before {
    content: "\25B6";
    display: inline-block;
    margin-right: 0.5rem;
    font-size: 0.8rem;
    transition: transform 0.2s ease;
}

.guild-notes[open] summary::before {
    transform: rotate(90deg);
}

.guild-notes-body {
    padding: 0 1.5rem 1.25rem;
    color: var(--color-text-muted);
    text-shadow: var(--shadow-text-light);
    line-height: 1.7;
}

/* Province Cards */
.province-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-card);
    text-align: left;
}

.province-card h4 {
    margin: 0 0 1rem;
}

.province-card h4 a {
    color: var(--color-gold);
    text-decoration: none;
    text-shadow: var(--shadow-text);
    font-weight: 600;
}

.province-card h4 a:hover {
    color: #fff;
    text-decoration: underline;
}

.province-card ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.province-card ul li {
    padding: 0.3rem 0;
}

.province-card ul li a {
    color: var(--color-gold);
    text-decoration: none;
    transition: var(--transition-base);
}

.province-card ul li a:hover {
    color: #fff;
    text-decoration: underline;
}

/* Domaine Grid inside Province Cards */
.domaine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

/* Territory Nesting */
.territory-level {
    margin-left: 1.5rem;
    padding-left: 1rem;
    border-left: 1px solid var(--glass-border);
    margin-top: 0.75rem;
}

.territory-level h5 {
    color: var(--color-text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-shadow: var(--shadow-text);
}

.territory-level h5 a {
    color: var(--color-gold);
    text-decoration: none;
}

.territory-level h5 a:hover {
    color: #fff;
    text-decoration: underline;
}

.territory-level h6 {
    color: var(--color-text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-shadow: var(--shadow-text);
}

.territory-level h6 a {
    color: var(--color-gold);
    text-decoration: none;
}

.territory-level h6 a:hover {
    color: #fff;
    text-decoration: underline;
}

/* Guild Title Labels (GitLab-style) */
.guild-title-label {
    display: inline-block;
    padding: 2px 8px;
    margin-left: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    border-radius: 10px;
    background: var(--color-gold-dim);
    color: var(--color-gold);
    border: 1px solid var(--color-gold-border);
    vertical-align: middle;
    text-decoration: none;
}

a.guild-title-label:hover {
    background: var(--color-gold-border);
    color: #fff;
    text-decoration: none;
}

/* Domaine Detail Header */
.domaine-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
}

.domaine-header-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.domaine-header > a {
    position: absolute;
    right: 0;
}

.guild-label-logo {
    height: 1em;
    width: auto;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 0.25rem;
    border-radius: 2px;
}

/* Sortable Table Headers */
table.sortable thead th {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.25em;
}

table.sortable thead th::after {
    content: "\2195";
    position: absolute;
    right: 0.4em;
    opacity: 0.3;
    font-size: 0.8em;
}

table.sortable thead th.sort-asc::after {
    content: "\25B2";
    opacity: 0.9;
}

table.sortable thead th.sort-desc::after {
    content: "\25BC";
    opacity: 0.9;
}

/* Character Cards */
.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.25rem;
    text-align: center;
}

.character-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.25rem 1rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    backdrop-filter: var(--glass-blur);
    box-shadow: var(--shadow-card);
    text-decoration: none;
    transition: var(--transition-base);
}

.character-card:hover {
    background: var(--glass-bg-hover);
    border-color: var(--glass-border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
    text-decoration: none;
}

.character-card-photo {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border-radius: 50%;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-photo);
}

.character-detail-photo {
    max-height: 300px;
}

.character-detail-role-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    vertical-align: middle;
    margin-left: 0.5rem;
}

.character-card-photo-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    margin-bottom: 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px dashed var(--glass-border-strong);
}

.character-card-role-icon {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-bg-purple);
    box-shadow: var(--shadow-photo);
}

.character-card-guild-icon {
    position: absolute;
    top: -6px;
    left: -6px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--color-bg-purple);
    box-shadow: var(--shadow-photo);
    background: var(--glass-bg);
}

.region-breakdown-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
}

.region-breakdown-table th,
.region-breakdown-table td {
    padding: 0.6rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.region-breakdown-table th {
    color: var(--color-gold);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.region-breakdown-table tr.clickable-row {
    cursor: pointer;
    transition: var(--transition-base);
}

.region-breakdown-table tr.clickable-row:hover {
    background: var(--glass-bg-hover);
}

.region-breakdown-table td a {
    color: var(--color-text-primary);
    text-decoration: none;
    display: block;
    width: 100%;
}

.character-card-name {
    color: var(--color-text-primary);
    font-weight: 600;
    font-size: 0.95rem;
    text-shadow: var(--shadow-text);
    margin-bottom: 0.25rem;
}

/* Hierarchy tree: High Priest on top, vertical dotted line, Cleric below */
.hierarchy-tree {
    display: flex;
    flex-wrap: wrap;
    gap: 2.5rem;
    justify-content: center;
}

.hierarchy-branch {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hierarchy-connector {
    width: 2px;
    height: 40px;
    border-left: 2px dotted var(--glass-border-strong, rgba(255, 255, 255, 0.25));
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Responsive design - global theme adjustments */
@media (max-width: 768px) {
    .nav-container {
        padding: 0 1rem;
    }

    .nav-links {
        gap: 1rem;
    }

    .top-nav .nav-link {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }

    .guild-container {
        padding: 4rem 1rem 2rem;
    }

    .full-width-container {
        padding: 4rem 1rem 2rem;
    }

    .guild-name {
        font-size: 2rem;
    }

    .page-title {
        font-size: 2rem;
    }

    .heraldry img {
        max-width: 300px;
    }

    .guild-content {
        font-size: 1rem;
    }

    .lore-content {
        font-size: 1rem;
    }

    .lore-content p {
        text-align: left;
    }

    .greeting {
        font-size: 1.2rem;
    }

    .tagline {
        font-size: 1rem;
    }

    .navigation {
        gap: 1rem;
    }

    .nav-link {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }

    .registration-form {
        margin: 1.5rem auto;
        padding: 1.5rem;
        max-width: calc(100% - 2rem);
    }

    .form-group {
        margin-bottom: 1.25rem;
    }

    .form-group label {
        font-size: 0.9rem;
    }

    .form-input {
        padding: 0.8rem;
        font-size: 0.9rem;
    }

    .form-submit {
        padding: 1rem 1.5rem;
        font-size: 1rem;
    }

    .error-message {
        font-size: 0.8rem;
        padding: 0.4rem;
    }

    .general-error {
        margin: 1rem;
        padding: 0.8rem;
        font-size: 0.9rem;
    }

    .guild-header {
        flex-direction: column;
    }

    .guild-stats {
        width: 100%;
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Info tooltip for resource output explanation */
.info-tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
    color: var(--color-gold, #c8a84e);
    margin-left: 0.25rem;
    vertical-align: middle;
}

.info-tooltip .info-tooltip-content {
    display: none;
    position: absolute;
    bottom: 100%;
    right: 0;
    margin-bottom: 0.5rem;
    background: var(--color-bg-dark, #1a1a2e);
    border: 1px solid var(--color-gold, #c8a84e);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    line-height: 1.4;
    white-space: nowrap;
    color: #ddd;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.info-tooltip:hover .info-tooltip-content,
.info-tooltip:focus .info-tooltip-content {
    display: block;
}
