/**
 * 3-Box Fullscreen Layout System
 * For desktop tools requiring immersive fullscreen experience
 *
 * Layout:
 * - Top-left: Navigation (back, social, theme, lang)
 * - Bottom-left: Tool info & controls (scrollable)
 * - Right: Main content area (scrollable, spans both rows)
 *
 * Target viewport: 1200x560px (no scroll on page body)
 * Extracted from: emoji-memory.php
 */

/* ===== Fullscreen Tool Basics ===== */
body.fullscreen-tool .navbar {
    display: none;
}

body.fullscreen-tool .main-content {
    padding: 19px 0 0 0;
}

body.fullscreen-tool .tool-container {
    margin-bottom: 17px;
}

/* ===== 3-Box Grid Layout ===== */
.tool-container {
    max-width: 100%;
    width: 100%;
    padding: 0;
    height: calc(100vh - 57px);
    display: flex;
    flex-direction: column;
}

.game-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    grid-template-rows: auto 1fr;
    gap: 20px;
    flex: 1;
    height: 100%;
    overflow: hidden;
}

/* ===== Sidebar Components ===== */
.game-sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

.game-sidebar-top {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.game-sidebar-bottom {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ===== Navigation Bar (Top-Left Box) ===== */
.sidebar-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
}

.back-btn-sidebar {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    text-decoration: none;
    font-size: 1.2rem;
    transition: all 0.2s;
}

.back-btn-sidebar:hover {
    transform: scale(1.05);
    border-color: var(--primary);
    color: var(--primary);
}

/* ===== Tool Name Header (next to back button) ===== */
.tool-name-header {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    margin-left: 12px;
    overflow: hidden;
}

.tool-name-header .tool-emoji {
    font-size: 1.3rem;
    flex-shrink: 0;
}

.tool-name-header .tool-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ===== Social Share Buttons ===== */
.social-buttons-inline {
    display: flex;
    gap: 6px;
}

.social-btn-sm {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.2s;
    text-decoration: none;
}

.social-btn-sm:hover {
    opacity: 0.85;
    transform: scale(1.08);
}

.social-btn-sm.twitter {
    background: #000;
}

.social-btn-sm.facebook {
    background: #1877f2;
}

.social-btn-sm.whatsapp {
    background: #25d366;
}

.social-btn-sm.telegram {
    background: #0088cc;
}

/* ===== Theme Toggle ===== */
.theme-toggle-sidebar {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.theme-toggle-sidebar:hover {
    transform: scale(1.05);
    border-color: var(--primary);
}

[data-theme="dark"] .theme-icon-light {
    display: inline;
}

[data-theme="dark"] .theme-icon-dark {
    display: none;
}

[data-theme="light"] .theme-icon-light {
    display: none;
}

[data-theme="light"] .theme-icon-dark {
    display: inline;
}

/* ===== Language Selector ===== */
.lang-dropdown-sidebar {
    position: relative;
}

.lang-btn-sidebar {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    font-weight: 600;
}

.lang-btn-sidebar:hover {
    border-color: var(--primary);
}

.lang-btn-sidebar .lang-flag {
    font-size: 1rem;
}

.lang-btn-sidebar .lang-code {
    font-size: 0.8rem;
    color: var(--text);
}

.lang-menu-sidebar {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 5px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 160px;
    z-index: 1000;
    display: none;
}

.lang-menu-sidebar.show {
    display: block;
}

.lang-menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s;
    font-size: 0.85rem;
}

.lang-menu-item:hover {
    background: var(--bg);
}

.lang-menu-item.active {
    background: var(--primary);
    color: white;
}

.lang-menu-item .lang-flag {
    font-size: 1rem;
}

/* ===== Tool Header (in Bottom-Left Box) ===== */
.tool-header {
    margin-bottom: 0;
    padding: 18px 18px 0 18px;
}

.tool-header h1 {
    font-size: 1.4rem;
    margin-bottom: 6px;
    line-height: 1.2;
}

.tool-header p {
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 0;
}

/* ===== Tool Box (Settings Container) ===== */
.game-sidebar-bottom .tool-box {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 15px 18px 18px 18px;
    background: none !important;
    border: none !important;
    margin-bottom: 0;
}

/* ===== Form Components ===== */
.setting-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
}

.setting-group label {
    font-weight: 600;
    color: var(--text);
    font-size: 0.9rem;
    white-space: nowrap;
}

.setting-group .form-input {
    padding: 9px 12px;
    font-size: 0.9rem;
    flex: 1;
}

/* ===== Stats Display ===== */
.game-stats {
    display: flex;
    flex-direction: row;
    gap: 10px;
}

.stat-box {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    flex: 1;
}

.stat-icon {
    font-size: 1.5rem;
}

.stat-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-light);
    line-height: 1;
    margin-bottom: 3px;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    font-family: 'Courier New', monospace;
    line-height: 1.2;
}

/* ===== Buttons ===== */
.btn-block {
    width: 100%;
    justify-content: center;
    padding: 10px 16px;
    font-size: 0.95rem;
}

/* ===== Main Content Area (Right Box) ===== */
.game-main {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    grid-column: 2;
    grid-row: 1 / 3;
    overflow: auto;
    padding: 20px;
}

/* ===== Modal/Overlay Messages ===== */
.win-message {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.win-message.hidden {
    display: none;
}

.win-content {
    background: var(--bg-card);
    padding: 25px 30px;
    border-radius: 16px;
    text-align: center;
    max-width: 350px;
    animation: slideUp 0.5s ease;
}

.win-emoji {
    font-size: 3.5rem;
    margin-bottom: 12px;
    animation: bounce 1s infinite;
}

.win-content h2 {
    font-size: 1.5rem;
    margin-bottom: 10px;
    color: var(--text);
}

.win-content p {
    color: var(--text-light);
    margin-bottom: 18px;
    font-size: 0.95rem;
}

/* Modal Close Button */
.win-content {
    position: relative;
}

.modal-close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1.4rem;
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    line-height: 1;
    padding: 0;
}

.modal-close-btn:hover {
    background: var(--bg-card);
    color: var(--text);
    transform: scale(1.1);
    border-color: var(--primary);
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

/* ===== Responsive Breakpoints ===== */

/* Tablet (1024px and below) */
@media (max-width: 1024px) {
    body.fullscreen-tool .navbar {
        display: flex; /* Show navbar on tablet/mobile */
    }

    body.fullscreen-tool .main-content {
        padding: 10px 0;
    }

    .tool-container {
        height: auto;
    }

    .game-sidebar-top {
        display: none; /* Hide top navigation on tablet/mobile */
    }

    .game-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        gap: 20px;
        height: auto;
    }

    .game-sidebar-bottom {
        overflow-y: visible;
    }

    .game-main {
        grid-column: 1;
        grid-row: auto;
        height: auto;
        min-height: 400px;
    }

    .tool-header h1 {
        font-size: 1.75rem;
    }
}

/* Mobile (768px and below) */
@media (max-width: 768px) {
    .tool-header h1 {
        font-size: 1.5rem;
    }

    .setting-group {
        flex-direction: column;
        align-items: stretch;
    }

    .setting-group label {
        text-align: left;
    }

    .game-stats {
        flex-direction: column;
        gap: 10px;
    }

    .stat-box {
        padding: 12px;
        width: 100%;
    }

    .win-content {
        padding: 30px 20px;
        margin: 20px;
    }
}
