/* =========================================================================
   core/base.css — styles shared across the WHOLE platform (every game).
   Page reset, nav/slide-menu, chat, the overlay/dialog system, form
   controls, status messages, and shared utilities. Game- or feature-
   specific styles live next to their feature (account/account.css,
   deckManager/MTG/deckManager.css, gameManager/MTG/player.css+opponent.css).
   Loaded FIRST (see paths.json loadOrder.css).
   ========================================================================= */

/* ---------- Page reset (was inline in index.php) ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font: 13px Helvetica, Arial;
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
}

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

/* ---------- Chat (currently display:none in index.php) ---------- */
form { background: #fff; padding: 3px; position: fixed; bottom: 0; width: 100%; border-color: #000; border-top-style: solid; border-top-width: 1px;}
form input { border-style: solid; border-width: 1px; padding: 10px; width: 85%; margin-right: .5%; }
form button { width: 9%; background: rgb(130, 224, 255); border: none; padding: 10px; margin-left: 2%; }
#messages { list-style-type: none; margin: 0; padding: 0; margin-top: 20px;}
#messages li { padding: 5px 10px; }
#messages li:nth-child(odd) { background: #eee; }

/* ---------- Top nav + slide menu (was inline in index.php) ---------- */
.nav-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

.top-nav {
    height: 20px;
    width: 100%;
    background-color: #f5f5f5;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    padding: 0 10px;
    position: relative;
    z-index: 5;
}

.menu-button {
    width: 40px;
    height: 40px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    padding: 0;
    margin-top: 35px;
}

.menu-button:hover {
    background-color: #f8f8f8;
}

.menu-button:active {
    background-color: #f0f0f0;
}

.menu-line {
    width: 20px;
    height: 2px;
    background-color: #333;
    transition: all 0.3s ease;
}

.slide-menu {
    position: absolute;
    top: 20px;
    left: 0;
    width: 200px;
    background: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transform: translateY(-100%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.slide-menu.active {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.menu-item {
    padding: 15px 20px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.menu-item:hover:not(#userProfile) {
    background-color: #f5f5f5;
}

.menu-item:active:not(#userProfile) {
    background-color: #e8e8e8;
}

/* ---------- Overlay + dialog system (used by every dialog) ---------- */
.account-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.75);
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* Show the overlay when not hidden */
.account-overlay:not(.hidden) {
    display: flex;
}

.account-dialog {
    background: white;
    width: 400px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08);
    position: relative;
    padding: 24px;
}

.close-button {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.close-icon {
    width: 24px;
    height: 24px;
    color: #666;
    transition: color 0.2s ease;
}

.close-button:hover .close-icon {
    color: #333;
}

.dialog-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 24px;
    text-align: center;
}

/* ---------- Form controls ---------- */
.form-group {
    margin-bottom: 16px;
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.full-width {
    width: 100%;
}

.half-width {
    width: 50%;
}

label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 6px;
    color: #555;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.2s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
    border-color: #2563eb;
    outline: none;
}

.button-container {
    margin-top: 24px;
}

.dialog-button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 6px;
    background-color: #2563eb;
    color: white;
    font-weight: 500;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.dialog-button:hover {
    background-color: #1d4ed8;
}

.secondary-button {
    background-color: #f1f5f9;
    color: #1e293b;
    border: 1px solid #e2e8f0;
}

.secondary-button:hover {
    background-color: #e2e8f0;
}

/* Generic dialog action row (create-deck, delete-deck, ...) */
.deck-actions {
    display: flex;
    margin-top: 24px;
    gap: 16px;
}

.spacer {
    flex: 1;
}

.button-icon {
    margin-right: 8px;
    vertical-align: middle;
}

@media (max-width: 480px) {
    .deck-actions {
        flex-direction: column;
    }

    .spacer {
        height: 12px;
    }

    .secondary-button {
        order: 2;
    }
}

/* ---------- Status messages ---------- */
.error-message {
    background-color: #fee2e2;
    border: 1px solid #ef4444;
    color: #b91c1c;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.5;
}

.error-message::before {
    content: "⚠️";
    margin-right: 8px;
    font-size: 16px;
}

.error-message:not(.hidden),
.success-message:not(.hidden),
.info-message:not(.hidden) {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.success-message {
    background-color: #dcfce7;
    border: 1px solid #10b981;
    color: #047857;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
}

.success-message::before {
    content: "✅";
    margin-right: 8px;
    font-size: 16px;
}

.info-message {
    background-color: #e0f2fe;
    border: 1px solid #0ea5e9;
    color: #0369a1;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-size: 14px;
    line-height: 1.5;
    display: flex;
    align-items: flex-start;
}

.info-message::before {
    content: "ℹ️";
    margin-right: 8px;
    font-size: 16px;
}

/* ---------- Loading spinner (shared by several dialogs) ---------- */
.loading-container {
    text-align: center;
    padding: 32px 0;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 5px solid #e2e8f0;
    border-top: 5px solid #2563eb;
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
