/* Global Reset & Base */
:root {
    --sidebar-bg: #1a202c;
    --sidebar-text: #a0aec0;
    --sidebar-hover-bg: #2d3748;
    --sidebar-active-bg: #2c5282;
    --main-bg: #f7fafc;
    --text-color: #1a202c;
    --border-color: #e2e8f0;
}

body,
html {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: var(--main-bg);
    color: var(--text-color);
    height: 100%;
}

.denk-one {
  font-family: "Denk One" !important;
  font-weight: 400;
  font-style: normal;
}


.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Global Header */
.global-header {
    height: 60px;
    background-color: var(--sidebar-bg);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 50;
}

.header-brand {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: white;
}

.header-logo {
    width: 32px;
    height: 32px;
    margin-right: 0.75rem;
}

.header-title {
    font-size: 1.25rem;
    font-weight: bold;
}

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

/* User Profile in Header */
.header-profile-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.header-profile-trigger:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.profile-img-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
}

/* Profile Popup Modal */
.profile-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.profile-popup.active {
    opacity: 1;
    visibility: visible;
}

.profile-popup-content {
    background-color: #2d3748;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.profile-popup.active .profile-popup-content {
    transform: scale(1);
}

.profile-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background-color: rgba(255, 255, 255, 0.1);
    border: none;
    color: #e2e8f0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.2rem;
    transition: background-color 0.2s, transform 0.2s;
    z-index: 10;
}

.profile-popup-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.profile-popup-header {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px 20px 20px;
}

.profile-popup-image {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    border: 4px solid #4a5568;
    object-fit: cover;
}

.profile-popup-info {
    padding: 20px 30px;
}

.profile-popup-item {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
}

.profile-popup-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #a0aec0;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.profile-popup-value {
    font-size: 1.1rem;
    color: #e2e8f0;
    word-break: break-word;
}

.profile-popup-actions {
    padding: 20px 30px 30px;
    display: flex;
    gap: 1rem;
}

.profile-popup-btn {
    flex: 1;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    text-decoration: none;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    transition: all 0.2s;
}

.profile-popup-btn-logout {
    background-color: #e53e3e;
    color: white;
    border: none;
}

.profile-popup-btn-logout:hover {
    background-color: #c53030;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
}

.header-login-btn {
    background-color: #4285f4;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Workspace Layout (Sidebar + Content) */
.workspace {
    display: flex;
    flex: 1;
    /* Take remaining height */
    overflow: hidden;
    /* Prevent body scroll, handle inside components */
    position: relative;
    width: 100%;
}

/* Page Specific Sidebars */
.page-sidebar {
    width: 340px;
    background-color: #2d3748;
    /* Slightly lighter than header */
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #4a5568;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-section {
    padding: 1.5rem;
    border-bottom: 1px solid #4a5568;
}

.sidebar-title {
    text-transform: uppercase;
    font-size: 0.8rem;
    color: #a0aec0;
    margin-bottom: 1rem;
    font-weight: bold;
    letter-spacing: 0.05em;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    color: #cbd5e0;
    text-decoration: none;
    border-radius: 6px;
    margin-bottom: 0.25rem;
    transition: background 0.2s;
}

.sidebar-nav-item:hover {
    background-color: #4a5568;
    color: white;
}

.sidebar-nav-item.active {
    background-color: #3182ce;
    color: white;
}

.sidebar-nav-item i {
    width: 24px;
    text-align: center;
    margin-right: 0.5rem;
}

/* Page Content Area */
.page-content {
    flex: 1;
    overflow-y: auto;
    background-color: var(--main-bg);
    position: relative;
    padding: 0;
}

.page-content.editor {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: #1a202c;
    overflow: auto;
}

/* Play Page Layout (Flex Wrapper) */
.play-page-container {
    height: 100%;
    /* Fill workspace */
    width: 100%;
    display: flex;
    flex-direction: row;
    /* Horizontal layout */
}

/* Play Mode Overlay Wrapper - Switched to In-Place */
.game-container-wrapper {
    /* Previously fixed, now filling the center area */
    position: absolute;
    inset: 0;
    background-color: #1a202c;
    /* Match center bg */
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
}


/* Action Buttons (Bootstrap-style) - Moved from Editor for global use */
.action-btn-primary {
    display: inline-block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #fff;
    background-color: #0d6efd;
    border: 1px solid #0d6efd;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
    text-align: center;
    text-decoration: none;
}

.action-btn-primary:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
}

.action-btn-secondary {
    display: inline-block;
    width: 100%;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #6c757d;
    background-color: transparent;
    border: 1px solid #6c757d;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: color .15s ease-in-out, background-color .15s ease-in-out, border-color .15s ease-in-out, box-shadow .15s ease-in-out;
    text-align: center;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn-secondary:hover {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}