/* Nico Application - Black & Glossy White Theme */
:root {
    --bg-dark: #050505;
    /* Deepest Black */
    --bg-glass: rgba(255, 255, 255, 0.03);
    --border-glass: rgba(255, 255, 255, 0.08);
    --text-main: #ffffff;
    --text-muted: #888888;

    /* Accents */
    --accent-glow: 0 0 20px rgba(255, 255, 255, 0.1);
    --accent-white: #ffffff;
    --accent-green: #00ff9d;
    --danger: #ff4d4d;

    --radius: 16px;
    --font-main: 'Inter', system-ui, -apple-system, sans-serif;
}

* {
    box-sizing: border-box;
    outline: none;
}

body {
    margin: 0;
    font-family: var(--font-main);
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* --- Login Screen --- */
#login-screen {
    position: fixed;
    inset: 0;
    background-color: #000;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: default;
}

#hidden-password-input {
    width: 1px;
    height: 1px;
    opacity: 0;
    position: absolute;
}

.login-error {
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translate(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translate(-5px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translate(5px);
    }
}

/* --- Layout --- */
#dashboard-screen {
    display: none;
    opacity: 0;
    transition: opacity 0.6s ease;
    width: 100%;
    height: 100%;
    padding: 20px;
    background: radial-gradient(circle at top right, #1a1a1a 0%, #000 60%);
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 20px;
}

#dashboard-screen.visible {
    display: grid;
    opacity: 1;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
}

.brand {
    font-size: 2rem;
    font-weight: 900;
    letter-spacing: -1px;
    color: white;
    text-shadow: 0 0 15px rgba(255, 255, 255, 0.4);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Profile Card */
.profile-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 15px 6px 6px;
    border-radius: 30px;
    border: 1px solid var(--border-glass);
    backdrop-filter: blur(10px);
}

#profile-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    object-fit: cover;
}

.profile-info {
    display: flex;
    flex-direction: column;
    font-size: 0.85rem;
    line-height: 1.1;
}

#profile-name {
    font-weight: 700;
    color: white;
}

.status-text {
    font-size: 0.75rem;
    color: var(--accent-green);
}

/* Status Badge */
.status-badge {
    padding: 8px 16px;
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-glass);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
    transition: all 0.3s;
}

.status-dot.active {
    background-color: var(--accent-green);
    box-shadow: 0 0 10px var(--accent-green);
}

.status-dot.online {
    background-color: #03dac6;
    box-shadow: 0 0 10px #03dac6;
}

/* --- Grid --- */
.dashboard-grid {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 25px;
    height: 100%;
    overflow: hidden;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    padding-right: 5px;
}

.main-view {
    display: flex;
    flex-direction: column;
    gap: 20px;
    min-width: 0;
}

/* Glass Panels */
.glass-panel {
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius);
    padding: 24px;
    backdrop-filter: blur(20px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

h2 {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 20px 0;
    font-weight: 600;
}

/* Controls */
.btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    font-size: 0.9rem;
    margin-bottom: 12px;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-white {
    background: white;
    color: black;
    box-shadow: 0 4px 15px rgba(255, 255, 255, 0.1);
}

.btn-white:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.25);
}

.btn-success {
    background: linear-gradient(135deg, #00ff9d 0%, #00cc7e 100%);
    box-shadow: 0 4px 15px rgba(0, 255, 157, 0.2);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 255, 157, 0.4);
    filter: brightness(1.1);
}

.btn-stop {
    background: linear-gradient(135deg, #ff4b4b 0%, #cc0000 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 75, 75, 0.2);
}

.btn-stop:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 75, 75, 0.4);
    filter: brightness(1.1);
}

.btn-danger {
    background: rgba(255, 77, 77, 0.1);
    color: var(--danger);
    border: 1px solid var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
}

/* Settings */
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-row span {
    font-size: 0.95rem;
    color: #ddd;
}

.setting-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-glass);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    width: 70px;
    text-align: center;
    font-family: inherit;
}

.setting-input:focus {
    border-color: white;
}

/* Toggle Switch */
.switch {
    position: relative;
    width: 40px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    transition: .4s;
    border-radius: 22px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: var(--accent-white);
}

input:checked+.slider:before {
    transform: translateX(18px);
    background-color: black;
}

/* Library Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.search-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.3);
    padding: 5px 15px;
    border-radius: 12px;
    border: 1px solid var(--border-glass);
}

.search-wrapper:focus-within {
    border-color: rgba(255, 255, 255, 0.3);
}

#library-search {
    background: transparent;
    border: none;
    color: white;
    padding: 8px 0;
    width: 150px;
    font-family: inherit;
    font-size: 0.9rem;
}

.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 5px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.icon-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.rotating svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* Game Cards */
/* Horizontal Scroll for Active Games */
.scroll-container {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    display: flex;
    gap: 15px;
    padding-bottom: 20px;
    align-items: flex-start;
    user-select: none;
    cursor: grab;
}

/* Vertical Grid for Library - Fixed 2 rows with drag scroll */
.grid-container {
    overflow-y: auto;
    overflow-x: hidden;
    display: grid;
    /* 4 columns fixed width */
    grid-template-columns: repeat(4, 1fr);
    /* Fixed row height - prevents overlap */
    grid-auto-rows: 150px;
    gap: 20px;
    padding: 15px;
    align-content: start;
    /* Fixed height for exactly 2 rows */
    height: 380px;
    min-height: 380px;
    max-height: 380px;
    user-select: none;
    cursor: grab;
}

.grid-container.active {
    cursor: grabbing;
}

/* Loading message centered */
.grid-container .loading-container {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 280px;
}

.scroll-container::-webkit-scrollbar,
.grid-container::-webkit-scrollbar {
    height: 6px;
    width: 6px;
}

.scroll-container::-webkit-scrollbar-thumb,
.grid-container::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 10px;
}

.scroll-container::-webkit-scrollbar-track,
.grid-container::-webkit-scrollbar-track {
    background: transparent;
}

.game-card {
    display: flex;
    flex-direction: column;
    background: #000;
    border-radius: 12px;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
    border: 1px solid var(--border-glass);
    transition: transform 0.3s, box-shadow 0.3s;
    user-select: none;
    -webkit-user-drag: none;
}

.scroll-container .game-card {
    width: 130px;
    aspect-ratio: 1 / 1.3;
}

.grid-container .game-card {
    width: 100%;
    height: 100%;
}



.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.3);
}

.game-card img {
    width: 100%;
    flex: 1;
    /* Doldur */
    object-fit: cover;
    pointer-events: none;
    filter: brightness(0.9);
}

.game-card:hover img {
    filter: brightness(1.1);
}

.game-title {
    font-size: 0.70rem;
    padding: 8px 5px;
    white-space: normal;
    text-align: center;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #eee;
    background: #111;
    line-height: 1.2;
}

.game-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.game-card:hover .game-overlay {
    opacity: 1;
}

.action-icon {
    font-size: 1.5rem;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}

.action-icon:hover {
    background: white;
    color: black;
    transform: scale(1.1);
}

.remove-icon:hover {
    background: var(--danger);
    color: white;
}

/* Loading States */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-left-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 3000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open {
    display: flex;
}

.modal-content {
    background: #111;
    border: 1px solid var(--border-glass);
    padding: 40px;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Confirmation Modal Options */
.modal-actions {
    display: flex;
    gap: 15px;
    width: 100%;
    margin-top: 20px;
}

.modal-actions .btn {
    margin-bottom: 0;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 10px;
    color: white;
}

.modal-desc {
    color: #aaa;
    margin-bottom: 25px;
    line-height: 1.5;
}

.code-input {
    background: transparent;
    border: 2px solid #333;
    color: white;
    font-size: 2.5rem;
    letter-spacing: 15px;
    width: 240px;
    text-align: center;
    padding: 10px;
    border-radius: 12px;
    margin: 30px auto;
    text-transform: uppercase;
    display: block;
    font-family: monospace;
    transition: 0.3s;
}

.code-input:focus {
    border-color: var(--accent-white);
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        gap: 20px;
        overflow-y: auto;
    }

    .sidebar {
        order: 2;
        padding-bottom: 40px;
        max-height: none;
        overflow: visible;
    }

    .main-view {
        order: 1;
        min-height: 50vh;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .profile-card {
        padding: 4px 10px 4px 4px;
    }

    .game-card {
        width: 160px;
    }

    .game-card img {
        height: 90px;
    }
}