/* Montserrat font - tüm elementlere uygula */
body,
body * {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    box-sizing: border-box !important;
}

html,
body {
    width: 100%;
    max-width: 100vw;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

/* Fixed Header & Footer Standarts */
.header-fixed {
    position: fixed !important;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: 1152px;
    /* Aligned with max-w-6xl (1152px) */
    z-index: 1000 !important;
    pointer-events: none;
    /* Let clicks pass through to inner buttons if needed */
}

.header-fixed>*,
.footer-fixed>* {
    pointer-events: auto;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
}

.footer-fixed {
    position: fixed !important;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: 1152px;
    /* Aligned with max-w-6xl (1152px) */
    z-index: 1000 !important;
    pointer-events: none;
}

body.has-fixed-header {
    padding-top: 85px !important;
}

body.has-fixed-header-tall {
    padding-top: 95px !important;
}

body.has-fixed-footer {
    padding-bottom: 95px !important;
}

@media (max-width: 640px) {
    body.has-fixed-header {
        padding-top: 75px !important;
    }

    body.has-fixed-header-tall {
        padding-top: 160px !important;
    }

    body.has-fixed-footer {
        padding-bottom: 115px !important;
    }

    .header-fixed {
        top: 8px !important;
        width: calc(100% - 24px) !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
    }

    .footer-fixed {
        bottom: 8px !important;
        width: calc(100% - 24px) !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
    }

    /* Content padding for all pages with fixed elements */
    #app,
    .container,
    main {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
}


/* Mobile Header Compact Redesign */
@media (max-width: 640px) {
    .header-fixed.mobile-compact {
        flex-direction: column !important;
        align-items: stretch !important;
        padding: 8px 12px !important;
        gap: 8px !important;
        height: auto !important;
        /* min-height: 90px; Remove fixed height to let content dictate */
    }

    .header-fixed.mobile-compact>.header-brand {
        width: 100%;
        justify-content: center;
        position: relative;
    }

    .header-fixed.mobile-compact>.header-actions {
        width: 100%;
        justify-content: center;
        gap: 8px !important;
    }

    /* Make sure buttons in the action row are evenly sized or appropriate */
    .header-fixed.mobile-compact>.header-actions>* {
        flex: 1;
        justify-content: center;
    }

    /* Specific adjustments for specific buttons if needed */
    .header-fixed.mobile-compact #back-button-placeholder button,
    .header-fixed.mobile-compact #btn-open-profile {
        width: 100%;
    }

    /* Adjust body padding for taller header */
    body.has-fixed-header {
        padding-top: 100px !important;
    }
}

/* Room list scrollbar - applies to ALL screen sizes */
#rooms-owned-list,
#rooms-joined-list {
    display: block !important;
    /* Use block layout for simplicity */
    height: auto !important;
    /* Allow auto height to fit content */
    max-height: 170px !important;
    /* Limit height to approx 2 items */
    width: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    /* Auto scrollbar only when needed */
    -webkit-overflow-scrolling: touch !important;
    padding-right: 4px !important;
    /* Space for scrollbar */
}

/* Force scrollbar to be visible with explicit colors */
#rooms-owned-list::-webkit-scrollbar,
#rooms-joined-list::-webkit-scrollbar {
    width: 6px !important;
    /* Slightly thinner */
    background-color: var(--color-slate-950, #020617);
}

#rooms-owned-list::-webkit-scrollbar-thumb,
#rooms-joined-list::-webkit-scrollbar-thumb {
    background-color: var(--color-emerald-500, #10b981) !important;
    border-radius: 4px !important;
}

#rooms-owned-list::-webkit-scrollbar-track,
#rooms-joined-list::-webkit-scrollbar-track {
    background: var(--color-slate-950, #020617) !important;
}

#rooms-owned-list li,
#rooms-joined-list li {
    display: block !important;
    width: 100% !important;
    margin-bottom: 0.5rem !important;
    /* Gap replacement since we removed flex */
}

#rooms-owned-list li:last-child,
#rooms-joined-list li:last-child {
    margin-bottom: 0 !important;
}

#rooms-owned-list li>div,
#rooms-joined-list li>div {
    width: 100% !important;
    box-sizing: border-box !important;
    height: 80px !important;
    /* Fixed height for items */
}

/* Mobilde zoom yapılmasını engellemek için input, textarea ve select elementlerine minimum 16px font-size */
/* !important kullanarak Tailwind class'larını (text-xs, text-sm gibi) override ediyoruz */
input,
textarea,
select {
    font-size: 16px !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent !important;
    /* Şeffaf yaparak o siyah şeridi tamamen kaldırdım */
}

::-webkit-scrollbar-thumb {
    background: #00ff9d !important;
    /* Daha fosforlu ve parlak yeşil */
    border-radius: 10px;
    border: 2px solid #00000000;
    /* Şeffaf border ile thumb'ı daha belirginleştirdim */
}

::-webkit-scrollbar-thumb:hover {
    background: #00cc7e !important;
}

/* Notification Bubble Containers */
#notification-container-left,
#notification-container-right {
    position: fixed;
    bottom: 110px;
    /* Safely above floating icons */
    z-index: 5000;
    display: flex;
    flex-direction: column-reverse;
    gap: 6px;
    pointer-events: none;
}

#notification-container-left {
    left: 24px;
    align-items: flex-start;
}

#notification-container-right {
    right: 24px;
    align-items: flex-end;
}

/* Side Panels */
#side-users-panel,
#side-chat-panel {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#side-users-panel.-translate-x-full {
    transform: translateX(-100%);
}

#side-chat-panel.translate-x-full {
    transform: translateX(100%);
}

.notification-bubble {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.4);
    /* Default neutral border */
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.2);
    animation: slideInRight 0.3s ease-out forwards;
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 260px;
    line-height: 1.3;
}

/* Notification Types */
.notification-bubble.success,
.notification-bubble.joined {
    border-color: rgba(16, 185, 129, 0.4);
}

.notification-bubble.error,
.notification-bubble.left,
.notification-bubble.delete {
    border-color: rgba(248, 113, 113, 0.4);
}

.notification-bubble.info {
    border-color: rgba(59, 130, 246, 0.4);
}

.notification-bubble.warning,
.notification-bubble.kicked {
    border-color: rgba(245, 158, 11, 0.4);
}

.notification-bubble i {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.notification-bubble span {
    white-space: normal;
    word-break: break-word;
}

.notification-bubble.left {
    animation: slideInLeft 0.3s ease-out forwards;
}

.notification-bubble.right {
    animation: slideInRight 0.3s ease-out forwards;
}

.notification-bubble.fade-out {
    animation: fadeOutDown 0.5s ease-in forwards;
}

@keyframes fadeOutDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(20px);
        opacity: 0;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOutDown {
    from {
        transform: translateY(0);
        opacity: 1;
    }

    to {
        transform: translateY(-20px);
        /* Changed to -20px to fade "up" out of screen or just fade */
        opacity: 0;
    }
}

/* Firefox */
html {
    scrollbar-width: thin;
    scrollbar-color: #00ff9d transparent;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none !important;
}

.scrollbar-hide {
    -ms-overflow-style: none !important;
    scrollbar-width: none !important;
}

/* Mobile-specific overflow prevention - MOVED TO END FOR SPECIFICITY */
@media (max-width: 640px) {
    body {
        background-attachment: scroll !important;
        overflow-x: hidden !important;
        position: relative;
    }

    #app {
        max-width: 100vw;
        overflow-x: hidden;
    }

    #app>* {
        max-width: 100%;
    }

    .grid {
        overflow-x: hidden;
    }

    .break-all {
        overflow-wrap: break-word;
        word-wrap: break-word;
        word-break: break-word;
    }

    input,
    textarea,
    select {
        max-width: 100%;
        box-sizing: border-box;
        min-width: 0;
    }

    .px-4 {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }

    .fixed.inset-0 {
        max-width: 100vw;
    }

    .max-w-6xl {
        max-width: 100vw !important;
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .flex {
        flex-wrap: wrap;
    }

    footer {
        max-width: 100vw;
        box-sizing: border-box;
    }

    .md\:grid-cols-2 {
        grid-template-columns: 1fr !important;
    }

    #settings-modal .grid-cols-3 {
        overflow: visible !important;
        gap: 0.25rem !important;
    }

    #settings-modal ::-webkit-scrollbar {
        display: none !important;
    }

    #settings-modal {
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
    }

    .overflow-hidden.bg-slate-950,
    .aspect-\[21\/9\] {
        overflow: hidden !important;
        scrollbar-width: none !important;
    }

    .aspect-\[21\/9\]::-webkit-scrollbar {
        display: none !important;
    }

    ::-webkit-scrollbar {
        display: none !important;
        width: 0 !important;
        height: 0 !important;
        background: transparent !important;
    }

    * {
        scrollbar-width: none !important;
        -ms-overflow-style: none !important;
    }

    /* Login page preview boxes - prevent scrollbars without breaking layout */
    .grid.pb-8 .group,
    .grid.pb-8 .group>div,
    .grid.pb-8 .group>div>div,
    .grid.pb-8 .group>div>div>div {
        overflow: hidden !important;
    }

    .grid.pb-8 .group::-webkit-scrollbar,
    .grid.pb-8 .group>div::-webkit-scrollbar,
    .grid.pb-8 .group>div>div::-webkit-scrollbar,
    .grid.pb-8 .group>div>div>div::-webkit-scrollbar {
        display: none !important;
    }

    /* Rooms page mobile optimizations */
    .premium-zoom-card {
        padding: 0.75rem !important;
        gap: 0.5rem !important;
    }

    #app {
        padding-top: 1rem !important;
        padding-bottom: 5rem !important;
    }

    main {
        gap: 0.75rem !important;
    }

    .grid.sm\:grid-cols-2.lg\:grid-cols-3 {
        gap: 0.75rem !important;
    }

    h2 {
        font-size: 1.125rem !important;
    }

    p.text-\[10px\] {
        font-size: 11px !important;
    }

    button.py-2 {
        padding-top: 0.5rem !important;
        padding-bottom: 0.5rem !important;
    }
}

/* Premium Hover Zoom Interaction */
.premium-zoom-card {
    will-change: box-shadow, border-color;
    position: relative;
    z-index: 1;
    /* backdrop-filter removed */
    background-color: rgba(15, 23, 42, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    overflow: hidden;
}

.premium-zoom-card:hover {
    /* transform removed */
    background-color: rgba(15, 23, 42, 0.6) !important;
    border-color: rgba(16, 185, 129, 0.4) !important;
    box-shadow: 0 10px 30px -10px rgba(16, 185, 129, 0.2);
}

/* Ambient Glow behind cards */
.premium-zoom-card::after {
    content: '';
    position: absolute;
    inset: -2px;
    background: radial-gradient(circle at center, rgba(16, 185, 129, 0.2), transparent 70%);
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
}

.premium-zoom-card:hover::after,
.group:hover .premium-zoom-card::after {
    opacity: 1;
}

.premium-zoom-inner,
.group:hover .premium-zoom-inner {
    transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1),
        background-color 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
}

/* Shine Effect class */
.shine-effect {
    position: absolute;
    top: 0;
    left: -150%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right,
            transparent,
            rgba(255, 255, 255, 0.05),
            transparent);
    transform: skewX(-25deg);
    transition: none;
    pointer-events: none;
    z-index: 10;
}

.premium-zoom-card:hover .shine-effect {
    left: 150%;
    transition: left 0.8s ease-in-out;
}

/* Micro Animations for Icons */
.animate-cog {
    display: inline-block;
    transition: transform 2s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
}

.group:hover .animate-cog {
    transform: rotate(180deg) scale(1.1) !important;
}

.animate-slide-arrow {
    transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
}

.group:hover .animate-slide-arrow {
    transform: translateX(3px) !important;
}

.animate-pulse-icon {
    transition: transform 1.2s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
}

.group:hover .animate-pulse-icon {
    transform: scale(1.1) !important;
}

/* Custom Styled Checkbox */
.custom-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 1rem;
    height: 1rem;
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 0.3rem;
    background: rgba(15, 23, 42, 0.6);
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-block;
}

@media (min-width: 640px) {
    .custom-checkbox {
        width: 1.15rem;
        height: 1.15rem;
        border-radius: 0.375rem;
    }
}

.custom-checkbox:checked {
    background: #10b981;
    border-color: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.3);
}

.custom-checkbox:checked::after {
    content: 'v';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -60%);
    color: #0f172a;
    font-size: 0.8rem;
    font-weight: 800;
}

.custom-checkbox:hover {
    border-color: rgba(16, 185, 129, 0.5);
    background: rgba(16, 185, 129, 0.1);
}

/* Interactive Bot Buttons */
.bot-difficulty-btn {
    transition: all 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.bot-difficulty-btn:hover {
    transform: translateY(-2px);
}

.bot-difficulty-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.05), transparent);
    transition: left 0.6s ease;
}

.bot-difficulty-btn:hover::before {
    left: 100%;
}

/* Character Counter */
.char-counter {
    font-size: 9px;
    font-weight: 600;
    transition: color 0.3s ease;
}

.char-counter.limit {
    color: #f87171;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-2px);
    }

    75% {
        transform: translateX(2px);
    }
}

/* Form Group Focus */
.form-group-focus {
    transition: all 0.3s ease;
    border-color: rgba(148, 163, 184, 0.2) !important;
}

.form-group-focus:focus-within {
    border-color: rgba(16, 185, 129, 0.5) !important;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.1);
    background: rgba(15, 23, 42, 0.8) !important;
}

.form-group-focus:focus-within i {
    color: #10b981 !important;
    transform: scale(1.1);
}

.form-group-focus i {
    transition: all 0.3s ease;
}

/* Input Placeholder Contrast */
.premium-zoom-card input::placeholder {
    color: rgba(148, 163, 184, 0.4) !important;
    opacity: 1;
}

.premium-zoom-card input:focus::placeholder {
    color: rgba(148, 163, 184, 0.2) !important;
}