﻿@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-color: #0f172a;
    --surface-color: #1e293b;
    --primary-color: #3b82f6;
    --accent-color: #10b981;
    --text-color: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(15, 23, 42, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: radial-gradient(circle at 50% 50%, #1e293b 0%, #0f172a 100%);
    color: var(--text-color);
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    width: 100vw;
    touch-action: none;
}

#editor-container {
    transform-origin: 0 0;
    /* Easier for pan/zoom math */
    touch-action: none;
    /* Prevent browser scaling/scrolling */
}

/* ────────────────────────────────────────
   COMMON UTILITIES
   ──────────────────────────────────────── */
.hidden,
.is-hidden {
    display: none !important;
}

.visually-hidden {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* ────────────────────────────────────────
   ACCESSIBILITY
   ──────────────────────────────────────── */
/* Modern focus indicator (only visible for keyboard users) */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 4px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    outline: none;
}

/* ────────────────────────────────────────
   LOADING OVERLAY
   ──────────────────────────────────────── */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 16px;
    z-index: 500;
    animation: fadeIn 0.2s ease-out;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    color: var(--text-color);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.3px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ────────────────────────────────────────
   STAGE & MEDIA CONTAINERS
   ──────────────────────────────────────── */
#main-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
}

#stage,
.stage {
    position: absolute;
    inset: 0;
    width: 100vw !important;
    height: 100vh !important;
    display: flex !important;
    justify-content: center;
    align-items: center;
    background: transparent;
    overflow: visible;
}

/* Projector Image */
.projector-image {
    width: 100%;
    height: 100%;
}

.projector-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #000;
    z-index: 20;
}

.video-playback-error {
    position: absolute;
    z-index: 25;
    left: 16px;
    right: 16px;
    bottom: 24px;
    padding: 12px 16px;
    color: #fff;
    background: rgba(127, 29, 29, 0.92);
    border: 1px solid rgba(248, 113, 113, 0.6);
    border-radius: 10px;
    text-align: center;
}

.video-playback-retry {
    min-height: 40px;
    margin-left: 12px;
    padding: 0 14px;
    color: #fff;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 8px;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.video-playback-retry:hover {
    background: rgba(255, 255, 255, 0.26);
}

/* PDF Canvas inline replacement */
.pdf-canvas {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

/* Link / Video Container */
.link-container {
    width: 100%;
    height: 100%;
    position: absolute;
    inset: 0;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
}

.video-frame {
    width: 100%;
    height: 100%;
    border: none;
}

.text-link-display {
    text-align: center;
    color: #fff;
    padding: 20px;
    max-width: 720px;
}

.text-link-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.text-link-title {
    font-size: 2rem;
    margin-bottom: 30px;
}

.clickable-link {
    font-size: 1.5rem;
    color: #fff;
    background: var(--primary-color);
    padding: 15px 30px;
    text-decoration: none;
    border-radius: 10px;
    display: inline-block;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.clickable-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}

.link-url-text {
    margin-top: 20px;
    font-size: 1.2rem;
    color: #ccc;
    word-break: break-all;
}

/* QR modal text overrides (replacing inline styles) */
.qr-modal-title {
    color: var(--text-color);
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.qr-modal-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

/* Lock container layout */
.lock-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* Projector image: keep aspect ratio centered */
#projector-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
}

/* Empty State Styling */
.empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--text-muted);
    z-index: 0;
    pointer-events: none;
    transition: opacity 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.05) 0%, transparent 70%);
    padding: 60px;
    border-radius: 50%;
}

.empty-state i {
    font-size: 5rem;
    margin-bottom: 24px;
    opacity: 0.8;
    color: var(--primary-color);
    animation: float 6s ease-in-out infinite, pulse-glow 3s infinite;
    filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.3));
}

.empty-state h2 {
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    color: var(--text-color);
}

.empty-state p {
    font-size: 1rem;
    opacity: 0.7;
    max-width: 300px;
    line-height: 1.5;
}

.room-text-empty {
    margin-top: 32px;
    font-size: 0.9rem !important;
    color: var(--text-muted) !important;
    opacity: 0.9;
    transition: all 0.3s;
    padding: 10px 24px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(10px);
}

.room-text-empty span {
    color: var(--primary-color);
    font-weight: 700;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse-glow {

    0%,
    100% {
        opacity: 0.8;
        filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.3));
    }

    50% {
        opacity: 1;
        filter: drop-shadow(0 0 30px rgba(59, 130, 246, 0.6));
    }
}

#pdf-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
    z-index: 1;
    object-fit: contain;
}

/* PDF Navigation Controls */
.pdf-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 8px 16px;
    z-index: 10;
    border-radius: 99px;
    background: rgba(30, 30, 30, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.pdf-btn {
    background: transparent;
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.pdf-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.pdf-btn:active {
    transform: scale(0.9);
}

#pdf-page-info {
    font-size: 0.9rem;
    font-weight: 500;
    color: white;
    min-width: 60px;
    text-align: center;
}


/* Top Left Links Container */
.top-links {
    position: absolute;
    top: 15px;
    left: 10px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    /* Stack vertically */
    gap: 10px;
}

/* Top Right Fullscreen */
.top-right-links {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.circle-link {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    /* Glassmorphism with darker background for better visibility */
    background: rgba(30, 30, 30, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    text-decoration: none;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0, 0, 0, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.circle-link:hover {
    background: rgba(40, 40, 40, 0.95);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.3);
}

.circle-link:active {
    transform: scale(0.95);
}

/* Full screen button özel animasyonu */
#btn-fullscreen {
    transition: all 0.3s ease;
}

#btn-fullscreen:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: var(--primary-color);
}

#btn-fullscreen i {
    transition: transform 0.2s ease;
}

#btn-fullscreen:hover i {
    transform: scale(1.1);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .circle-link {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }

    .top-links {
        top: 12px;
        left: 12px;
        gap: 8px;
    }

    .top-right-links {
        top: 12px;
        right: 12px;
    }

    .empty-state i {
        font-size: 3rem;
    }

    .empty-state h2 {
        font-size: 1.2rem;
    }

    /* Mobil editör alt çubuğu ve butonlarını daha kompakt yap */
    .camera-controls.glass-panel {
        gap: 6px;
        padding: 6px 8px !important;
        border-radius: 15px;
    }

    .camera-controls.glass-panel .action-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
        border-radius: 15px;
        min-width: auto;
    }

    .camera-controls.glass-panel .action-btn i {
        font-size: 0.85rem;
    }

    #btn-send {
        padding-inline: 12px;
    }

}

.top-links {
    position: fixed;
    top: 20px;
    left: 10px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    z-index: 1000;
    align-items: flex-start;
}

.more-options-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.options-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.options-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#btn-more-options i {
    transition: transform 0.3s ease;
}

#btn-more-options.active i {
    transform: rotate(90deg);
}

.room-indicator {
    padding: 8px 16px;
    border-radius: 30px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    font-size: 0.9rem;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.room-indicator i {
    color: #3b82f6;
    font-size: 0.8rem;
}

.room-indicator:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.room-indicator:active {
    transform: scale(0.95);
}

/* QR Modal Styles */
.qr-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.qr-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.qr-modal-content {
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.qr-close-btn {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.2s, background 0.2s;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.qr-close-btn:hover {
    background: #2563eb;
    transform: scale(1.1);
}

.qr-image {
    width: 300px;
    height: 300px;
    display: block;
    border-radius: 12px;
    background: white;
    padding: 10px;
}

.qr-links {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 25px;
}

.qr-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.qr-link:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}

.qr-link:active {
    transform: scale(0.98);
}

.qr-link-download {
    background: var(--accent-color);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.qr-link-download:hover {
    background: #059669;
    box-shadow: 0 6px 16px rgba(16, 185, 129, 0.5);
}

/* Custom Alert/Confirm Modal */
.custom-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.custom-modal.show {
    opacity: 1;
    visibility: visible;
}

.custom-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.custom-modal-content {
    position: relative;
    background: linear-gradient(135deg, rgba(30, 30, 30, 0.95) 0%, rgba(20, 20, 20, 0.98) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    padding: 30px 40px;
    min-width: 320px;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.05);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.custom-modal.show .custom-modal-content {
    transform: scale(1) translateY(0);
}

.custom-modal-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.custom-modal-icon.icon-success {
    color: #10b981;
}

.custom-modal-icon.icon-warning {
    color: #f59e0b;
}

.custom-modal-icon.icon-question {
    color: #8b5cf6;
}

.custom-modal-message {
    font-size: 1.1rem;
    color: #e5e7eb;
    margin-bottom: 25px;
    line-height: 1.6;
}

.custom-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-btn {
    padding: 12px 28px;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
}

.modal-btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.modal-btn-primary:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}

.modal-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #9ca3af;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.modal-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transform: translateY(-2px);
}

.modal-btn:active {
    transform: scale(0.98);
}

/* Toast Animations */
@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toast-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Page Controls Styles */
.page-controls {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    transition: all 0.3s ease;
}


.page-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.9rem;
}

.page-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.page-btn:active {
    transform: scale(0.95);
}

.page-btn.add-btn {
    background: var(--primary-color);
}

.page-btn.add-btn:hover {
    background: #2563eb;
}

.page-indicator {
    padding: 0 12px;
    font-weight: 600;
    font-size: 0.9rem;
    color: white;
    min-width: 80px;
    text-align: center;
    user-select: none;
}

.page-divider {
    width: 1px;
    height: 24px;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 4px;
}

/* Room Selection Modal */
.room-select-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: none;
}

.room-select-modal.show {
    opacity: 1;
    visibility: visible;
}

.room-select-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.88);
    pointer-events: none;
}

.room-select-content {
    position: relative;
    background: #111827;
    border: 1px solid #1f2937;
    border-radius: 20px;
    padding: 28px;
    padding-bottom: 75px;
    width: 420px;
    max-width: 95%;
    box-shadow: none;
    transform: none;
    transition: none;
}

.room-select-modal.show .room-select-content {
    transform: none;
}

.room-select-header {
    text-align: center;
    margin-bottom: 25px;
}

.room-select-header i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.room-select-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
}

.room-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 25px;
}

.room-item {
    background: #1f2937;
    border: 1px solid #374151;
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.room-item:hover {
    background: #273447;
    border-color: var(--primary-color);
    transform: none;
}

.room-item i {
    color: var(--text-muted);
}

.room-item .room-name {
    font-weight: 600;
    flex-grow: 1;
    margin-left: 12px;
}

.room-item.registered i {
    color: var(--primary-color);
}

.room-item.default i {
    color: var(--accent-color);
}

.new-room-input-group {
    position: relative;
    margin-top: 15px;
}

.new-room-input {
    width: 100%;
    background: #0b1220;
    border: 1px solid #374151;
    border-radius: 12px;
    padding: 14px 16px;
    padding-right: 50px;
    color: white;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.15s ease;
}

.new-room-input:focus {
    border-color: var(--primary-color);
    box-shadow: none;
}

/* Room Management Extensions */
.room-select-header {
    text-align: center;
    margin-bottom: 25px;
}

.room-mgmt-btn {
    position: absolute;
    bottom: 20px;
    left: 20px;
    width: 40px;
    height: 40px;
    border: 1px solid #374151;
    background: #1f2937;
    border-radius: 12px;
    color: var(--text-muted);
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    z-index: 100;
    pointer-events: auto;
}

.room-mgmt-btn:hover {
    background: #273447;
    color: white;
}

.room-mgmt-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.room-item-actions {
    display: flex;
    gap: 8px;
}

.room-action-btn {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    transition: background-color 0.15s ease, color 0.15s ease;
    background: #273447;
    color: white;
}

.room-action-btn.edit:hover {
    background: #fbbf24;
    color: #000;
}

.room-action-btn.delete:hover {
    background: #ef4444;
    color: white;
}

.management-mode .room-item {
    cursor: default;
}

.management-mode .room-item:hover {
    transform: none;
    border-color: rgba(255, 255, 255, 0.1);
}

.btn-add-room {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: var(--primary-color);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-add-room:hover {
    background: #2563eb;
    transform: translateY(-50%) scale(1.05);
}

.room-history-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    margin-bottom: 12px;
    font-weight: 700;
}

/* Mobile adjustments for Page Controls */
@media (max-width: 768px) {
    .page-controls {
        bottom: 80px;
        left: 50%;
        transform: translateX(-50%);
        padding: 6px;
    }

    .page-btn {
        width: 32px;
        height: 32px;
    }
}

/* Zoom Hint */
.zoom-hint {
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    white-space: nowrap;
    pointer-events: none;
    animation: fadeIn 0.3s ease;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Toast Notification System */
.toast-container {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 18px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 200px;
    max-width: 350px;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast i {
    font-size: 1.1rem;
}

.toast-success {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.95), rgba(5, 150, 105, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast-error {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.95), rgba(220, 38, 38, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast-info {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.95), rgba(37, 99, 235, 0.95));
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ========================================`r`n   RESPONSIVE & TOUCH EXPERIENCE UPGRADES`r`n   ======================================== */

/* Safe Area Insets (Notch-lu cihazlar: iPhone X+, Pixel, vb.) */
body {
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

/* Smooth scrolling everywhere */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* Better focus outlines for accessibility */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Minimum touch target size (44px as per Apple/Google HIG) */
button, a, .circle-link, .pdf-btn {
    min-height: 44px;
    min-width: 44px;
}

/* Prevent text selection during interactions */
.camera-controls, .top-links, .top-right-links {
    -webkit-user-select: none;
    user-select: none;
}

/* Touch-friendly button press feedback */
.circle-link:active,
.welcome-btn:active,
.action-btn:active,
.pdf-btn:active {
    transform: scale(0.92) !important;
    transition: transform 0.1s ease !important;
}

/* Haptic-style visual feedback pulse */
@keyframes tap-pulse {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4); }
    100% { box-shadow: 0 0 0 12px rgba(59, 130, 246, 0); }
}

/* ========================================
   REDUCED MOTION (Accessibility)
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .empty-state i {
        animation: none;
    }

    .ai-pulse {
        animation: none;
    }
}

/* Reduced motion class for low connection */
body.reduced-motion * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.15s !important;
}

/* ========================================
   IMPROVED MOBILE BREAKPOINTS
   ======================================== */

/* Small phones (< 360px) */
@media (max-width: 360px) {
    .circle-link {
        width: 32px;
        height: 32px;
        min-width: 32px;
        min-height: 32px;
        font-size: 0.8rem;
    }

    .welcome-title {
        font-size: 1.2rem;
    }

    .welcome-btn {
        padding: 14px 24px;
        font-size: 0.95rem;
    }

    .room-select-content {
        padding: 20px;
        padding-bottom: 65px;
    }

    .room-select-header h2 {
        font-size: 1.2rem;
    }

}

/* ========================================
   LANDSCAPE PHONE SUPPORT
   ======================================== */
@media (max-height: 500px) and (orientation: landscape) {
    .circle-link {
        width: 30px;
        height: 30px;
        min-width: 30px;
        min-height: 30px;
        font-size: 0.75rem;
    }

    .pdf-controls {
        bottom: 60px;
        padding: 4px 10px;
    }

    .empty-state {
        padding: 20px;
    }

    .empty-state i {
        font-size: 2rem;
        margin-bottom: 12px;
    }

    .empty-state h2 {
        font-size: 1rem;
    }

}

/* ========================================
   IMPROVED TOAST ON MOBILE
   ======================================== */
@media (max-width: 768px) {
    .toast-container {
        bottom: 80px;
        right: 15px;
        left: 15px;
    }

    .toast {
        max-width: 100%;
        min-width: auto;
    }

    /* QR modal responsive */
    .qr-image {
        width: 220px;
        height: 220px;
    }

    .qr-modal-content {
        padding: 20px;
    }

    .qr-link {
        padding: 12px 20px;
        font-size: 0.9rem;
    }

    /* Room modal mobile */
    .room-select-content {
        width: 95%;
        padding: 24px;
        padding-bottom: 70px;
        border-radius: 20px;
    }

    .room-item {
        padding: 12px 14px;
    }

    /* Custom modal mobile */
    .custom-modal-content {
        min-width: 280px;
        padding: 24px;
    }
}

/* ========================================
   SAFE AREA INSETS FOR BOTTOM UI
   ======================================== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    @media (max-width: 768px) {
        .toast-container {
            bottom: calc(80px + env(safe-area-inset-bottom));
        }

        .camera-controls {
            bottom: calc(30px + env(safe-area-inset-bottom));
        }
    }
}

/* ========================================
   HOVER ONLY ON DEVICES WITH POINTER
   (Prevents sticky :hover on touch devices)
   ======================================== */
@media (hover: none) {
    .circle-link:hover {
        background: rgba(30, 30, 30, 0.85);
        border-color: rgba(255, 255, 255, 0.3);
        transform: none;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0, 0, 0, 0.2);
    }

    .room-item:hover {
        transform: none;
    }

    .welcome-btn:hover {
        background: #3b82f6;
    }

    .welcome-btn.btn-secondary:hover {
        background: #6b7280;
    }

    .qr-link:hover {
        transform: none;
    }

    .modal-btn-primary:hover,
    .modal-btn-secondary:hover {
        transform: none;
    }
}


/* ========================================
   CONNECTION STATUS DOT
   ======================================== */
.connection-dot {
    position: fixed;
    top: 12px;
    right: 12px;
    z-index: 9999;
    cursor: default;
}

.connection-dot .dot {
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
    transition: background 0.3s, box-shadow 0.3s;
}

.connection-dot.online .dot {
    background: #10b981;
    box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.connection-dot.reconnecting .dot {
    background: #f59e0b;
    box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
    animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* ========================================
   IMPROVED SCROLLBAR FOR ALL MODALS
   ======================================== */
.room-list::-webkit-scrollbar {
    width: 5px;
}

.room-list::-webkit-scrollbar-track {
    background: transparent;
}

.room-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.room-list {
    max-height: 240px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .top-links, .top-right-links,
    .pdf-controls, .toast-container {
        display: none !important;
    }

    body {
        background: white;
        overflow: visible;
    }

    #main-container {
        overflow: visible;
    }
}
