/* =============================================================================
   RPG World - Main Site Styles

   This file contains application-specific styles that build upon:
   - Bootstrap 5.3 (loaded via CDN)
   - Font Awesome (loaded via CDN)
   - themes.css (theme variables and base styling)
============================================================================= */

/* =============================================================================
   Base HTML Settings
============================================================================= */

html {
    font-size: 14px;
    position: relative;
    min-height: 100%;
}

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

body {
    margin-bottom: 60px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Focus states - updated for theme compatibility */
.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
    box-shadow: 0 0 0 0.1rem var(--bg-primary), 0 0 0 0.25rem var(--input-focus-shadow);
}

/* =============================================================================
   Layout & Structure
============================================================================= */

/* Main content area */
.main-content {
    min-height: calc(100vh - 120px); /* Account for header and footer */
    padding: 2rem 0;
    flex: 1;
}

/* Container width adjustments */
.container-narrow {
    max-width: 720px;
}

.container-wide {
    max-width: 1400px;
}

/* =============================================================================
   Navigation Enhancements
============================================================================= */

.navbar {
    box-shadow: var(--shadow-md);
}

.navbar-brand {
    font-weight: 700;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.navbar-brand i {
    color: var(--brand-primary);
}

.nav-item .dropdown-menu {
    margin-top: 0.5rem;
}

/* User menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-menu .user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-medium);
}

.user-menu .user-avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: var(--brand-primary);
    color: var(--btn-primary-text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
}

/* =============================================================================
   Cards & Panels
============================================================================= */

.card {
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.card-title {
    font-weight: 600;
    margin-bottom: 1rem;
}

/* Feature card for dashboard */
.feature-card {
    text-align: center;
    padding: 2rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-card i {
    font-size: 3rem;
    color: var(--brand-primary);
    margin-bottom: 1rem;
}

.feature-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

/* Character card */
.character-card {
    position: relative;
    overflow: hidden;
}

.character-card .character-portrait {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-bottom: 1px solid var(--border-light);
}

.character-card .character-portrait-placeholder {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 4rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-light);
}

.character-card .character-info {
    padding: 1rem;
}

.character-card .character-name {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.character-card .character-details {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.character-card .character-level {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background-color: var(--brand-primary);
    color: var(--btn-primary-text);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.875rem;
}

/* Campaign card */
.campaign-card {
    position: relative;
}

.campaign-card .campaign-cover {
    width: 100%;
    height: 150px;
    object-fit: cover;
    border-bottom: 1px solid var(--border-light);
}

.campaign-card .campaign-cover-placeholder {
    width: 100%;
    height: 150px;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: rgba(255, 255, 255, 0.7);
    border-bottom: 1px solid var(--border-light);
}

.campaign-card .campaign-info {
    padding: 1rem;
}

.campaign-card .campaign-name {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.campaign-card .campaign-gm {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.campaign-card .campaign-players {
    display: flex;
    margin-top: 0.75rem;
}

.campaign-card .campaign-players .player-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    margin-left: -8px;
    border: 2px solid var(--card-bg);
}

.campaign-card .campaign-players .player-avatar:first-child {
    margin-left: 0;
}

/* =============================================================================
   Buttons & Actions
============================================================================= */

.btn {
    font-weight: 500;
    border-radius: var(--radius-md);
    padding: 0.5rem 1.25rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

/* Action buttons row */
.action-buttons {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* =============================================================================
   Forms
============================================================================= */

.form-label {
    font-weight: 500;
    margin-bottom: 0.375rem;
}

.form-text {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.form-control,
.form-select {
    border-radius: var(--radius-md);
    padding: 0.625rem 1rem;
}

/* Form sections */
.form-section {
    margin-bottom: 2rem;
}

.form-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-light);
}

/* =============================================================================
   Content Cards (used in admin and public pages)
============================================================================= */

.content-card {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.content-card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.content-card-header h5,
.content-card-header h6 {
    margin: 0;
    font-weight: 600;
    color: var(--text-primary);
}

.content-card-body {
    padding: 1.25rem;
}

/* =============================================================================
   Tables
============================================================================= */

.table {
    margin-bottom: 0;
}

.table th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.table-hover tbody tr:hover {
    cursor: pointer;
}

/* =============================================================================
   Badges & Status Indicators
============================================================================= */

.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    border-radius: var(--radius-sm);
}

.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.status-indicator::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-indicator.status-active::before {
    background-color: var(--status-success);
}

.status-indicator.status-inactive::before {
    background-color: var(--text-muted);
}

.status-indicator.status-pending::before {
    background-color: var(--status-warning);
}

/* =============================================================================
   Subscription Tier Badges
============================================================================= */

.tier-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.tier-badge.tier-free {
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
}

.tier-badge.tier-basic {
    background-color: #3b82f6;
    color: white;
}

.tier-badge.tier-premium {
    background-color: #8b5cf6;
    color: white;
}

.tier-badge.tier-professional {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
}

/* =============================================================================
   Empty States
============================================================================= */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state p {
    margin-bottom: 1.5rem;
}

/* =============================================================================
   Loading States
============================================================================= */

.loading-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--border-medium);
    border-radius: 50%;
    border-top-color: var(--brand-primary);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

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

.site-footer {
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-light);
    padding: 2rem 0;
    margin-top: auto;
}

.site-footer .footer-links {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.site-footer .footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
}

.site-footer .footer-links a:hover {
    color: var(--brand-primary);
}

.site-footer .copyright {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* =============================================================================
   Utility Classes
============================================================================= */

/* Spacing */
.section-spacing {
    margin-bottom: 3rem;
}

/* Text truncation */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Hover effects */
.hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-lift:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Cursor */
.cursor-pointer {
    cursor: pointer;
}

/* =============================================================================
   Responsive Adjustments
============================================================================= */

@media (max-width: 768px) {
    .main-content {
        padding: 1rem 0;
    }

    .feature-card {
        padding: 1.5rem;
    }

    .empty-state {
        padding: 2rem 1rem;
    }

    .action-buttons {
        flex-direction: column;
    }

    .action-buttons .btn {
        width: 100%;
    }
}

/* =============================================================================
   Animation Classes
============================================================================= */

.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
