/* ================================================
   WOTR Web Panel - Main Stylesheet
   ================================================ */

:root {
    /* Colors */
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16213e;
    --bg-hover: #1f2b47;
    
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --text-muted: #6b7280;
    
    --accent-primary: #4a90d9;
    --accent-success: #48bb78;
    --accent-warning: #ed8936;
    --accent-danger: #f56565;
    --accent-info: #4299e1;
    
    --border-color: rgba(255, 255, 255, 0.1);
    
    /* Spacing */
    --sidebar-width: 260px;
    --header-height: 60px;
    --border-radius: 12px;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* App Container */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-header .logo {
    font-size: 2rem;
}

.sidebar-header h1 {
    font-size: 1.1rem;
    font-weight: 600;
}

.sidebar-user {
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-color);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--accent-primary);
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 500;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Navigation */
.nav-menu {
    list-style: none;
    padding: 1rem 0;
    flex: 1;
    overflow-y: auto;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.nav-item a:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.nav-item.active a {
    background: rgba(74, 144, 217, 0.15);
    color: var(--accent-primary);
    border-right: 3px solid var(--accent-primary);
}

.nav-item .icon {
    width: 20px;
    text-align: center;
}

.nav-divider {
    padding: 1rem 1.5rem 0.5rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
}

.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--accent-danger);
    padding: 0.5rem;
    border-radius: 6px;
    transition: background 0.2s;
}

.logout-btn:hover {
    background: rgba(245, 101, 101, 0.1);
    text-decoration: none;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-header {
    height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
}

.content-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.server-status-mini {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border-radius: 20px;
    font-size: 0.85rem;
}

.server-status-mini .status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
}

.server-status-mini.online .status-dot {
    background: var(--accent-success);
    box-shadow: 0 0 8px var(--accent-success);
}

.server-status-mini.offline .status-dot {
    background: var(--accent-danger);
}

.content-body {
    flex: 1;
    padding: 2rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    font-size: 2rem;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(74, 144, 217, 0.1);
    border-radius: 12px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1.5rem;
}

.dashboard-grid > .welcome-card { grid-column: span 8; }
.dashboard-grid > .server-status-card { grid-column: span 4; }
.dashboard-grid > .stats-grid { grid-column: span 12; }
.dashboard-grid > .characters-card { grid-column: span 8; }
.dashboard-grid > .online-players-card { grid-column: span 4; }

/* Welcome Card */
.welcome-card {
    background: linear-gradient(135deg, var(--bg-card) 0%, #1f3a5f 100%);
}

.welcome-content {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem;
}

.welcome-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--accent-primary);
}

.welcome-text h2 {
    margin-bottom: 0.5rem;
}

.welcome-text p {
    color: var(--text-secondary);
}

/* Server Status Card */
.server-status-card .status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 8px;
}

.server-status-card.online .status-dot {
    background: var(--accent-success);
    box-shadow: 0 0 10px var(--accent-success);
}

.server-status-card.offline .status-dot {
    background: var(--accent-danger);
}

.server-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.info-item {
    display: flex;
    flex-direction: column;
}

.info-item .label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.info-item .value {
    font-weight: 600;
}

/* Character List */
.character-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.character-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.character-item:hover {
    background: var(--bg-hover);
}

.character-item.active {
    border-color: var(--accent-success);
    background: rgba(72, 187, 120, 0.1);
}

.character-info {
    display: flex;
    flex-direction: column;
}

.character-name {
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.character-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.character-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Character Grid */
.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.character-card {
    display: block;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
}

.character-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary);
    text-decoration: none;
}

.character-card.active {
    border-color: var(--accent-success);
}

.character-card-header {
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: rgba(255, 255, 255, 0.02);
}

.character-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--accent-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
}

.active-badge {
    background: var(--accent-success);
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.character-card-body {
    padding: 1.5rem;
}

.character-card-body h3 {
    margin-bottom: 0.5rem;
}

.character-card-body .faction,
.character-card-body .rank {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.character-card-footer {
    padding: 1rem 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
}

.character-card-footer .stat {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.2em 0.6em;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 4px;
}

.badge-success {
    background: rgba(72, 187, 120, 0.2);
    color: var(--accent-success);
}

.badge-warning {
    background: rgba(237, 137, 54, 0.2);
    color: var(--accent-warning);
}

.badge-danger {
    background: rgba(245, 101, 101, 0.2);
    color: var(--accent-danger);
}

.badge-lg {
    font-size: 0.85rem;
    padding: 0.4em 1em;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background: #3a7fc9;
    text-decoration: none;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.3s ease;
}

.alert-success {
    background: rgba(72, 187, 120, 0.15);
    border: 1px solid rgba(72, 187, 120, 0.3);
    color: var(--accent-success);
}

.alert-error {
    background: rgba(245, 101, 101, 0.15);
    border: 1px solid rgba(245, 101, 101, 0.3);
    color: var(--accent-danger);
}

.alert-warning {
    background: rgba(237, 137, 54, 0.15);
    border: 1px solid rgba(237, 137, 54, 0.3);
    color: var(--accent-warning);
}

.alert-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.7;
}

.alert-close:hover {
    opacity: 1;
}

@keyframes slideIn {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Player List */
.player-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.player-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
}

.player-name {
    font-weight: 500;
}

.player-faction {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Detail Page */
.breadcrumb {
    margin-bottom: 1.5rem;
}

.breadcrumb a {
    color: var(--text-secondary);
}

.character-detail {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.character-header {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 2rem;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.character-header .character-avatar {
    width: 100px;
    height: 100px;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-primary);
    border-radius: 50%;
    font-size: 2.5rem;
    font-weight: 700;
}

.character-title h1 {
    margin-bottom: 0.25rem;
}

.character-subtitle {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

/* Finance Stats */
.finance-stats {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.finance-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.finance-item:last-child {
    border-bottom: none;
}

.finance-item.total {
    background: rgba(74, 144, 217, 0.1);
    margin: 0 -1.5rem -1.5rem;
    padding: 1rem 1.5rem;
}

.finance-item .value.money {
    font-weight: 600;
    color: var(--accent-success);
}

/* Playtime Display */
.playtime-display {
    text-align: center;
    padding: 1rem;
}

.playtime-value {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.playtime-label {
    color: var(--text-muted);
}

/* Status Bars */
.status-bars {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.status-bar {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-bar .label {
    width: 80px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.bar-container {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.bar {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.bar.health {
    background: linear-gradient(90deg, #f56565 0%, #48bb78 100%);
}

.bar.armor {
    background: var(--accent-primary);
}

.status-bar .value {
    width: 30px;
    text-align: right;
    font-size: 0.85rem;
}

/* Info Table */
.info-table {
    width: 100%;
}

.info-table td {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.info-table td:first-child {
    color: var(--text-muted);
    width: 40%;
}

.info-table tr:last-child td {
    border-bottom: none;
}

code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.2em 0.4em;
    border-radius: 4px;
    font-size: 0.85em;
}

/* History List */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    font-size: 0.9rem;
}

.history-type {
    background: var(--bg-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    text-transform: uppercase;
}

.history-data {
    flex: 1;
    color: var(--text-secondary);
}

.history-time {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.empty-state h2 {
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-secondary);
}

/* Utilities */
.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--accent-success);
}

.text-danger {
    color: var(--accent-danger);
}

/* Responsive */
@media (max-width: 1024px) {
    .dashboard-grid > .welcome-card,
    .dashboard-grid > .characters-card {
        grid-column: span 12;
    }
    
    .dashboard-grid > .server-status-card,
    .dashboard-grid > .online-players-card {
        grid-column: span 6;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .app-container.sidebar-open .sidebar {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar-toggle {
        display: block;
    }
    
    .dashboard-grid > * {
        grid-column: span 12 !important;
    }
    
    .content-body {
        padding: 1rem;
    }
    
    .character-header {
        flex-direction: column;
        text-align: center;
    }
    
    .server-info {
        grid-template-columns: 1fr;
    }
}
