/* Tablet Common Styles */

/* Global Scrolling Control */
html.tablet-page,
body.tablet-page {
    overscroll-behavior: none;
    overscroll-behavior-y: none;
    overscroll-behavior-x: none;
    /* Prevent scrolling on body/html - only allow in specific containers */
    overflow: hidden !important;
    height: 100vh !important;
    max-height: 100vh !important;
    position: fixed !important;
    width: 100% !important;
    touch-action: none;
}

html.tablet-page .category-container,
html.tablet-page .items-container {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    touch-action: pan-y;
}

html.tablet-page .tablet-welcome-screen,
html.tablet-page .tablet-capture-screen,
html.tablet-page .tablet-preview-screen,
html.tablet-page .tablet-process-screen,
html.tablet-page .tablet-results-screen,
html.tablet-page .tablet-profile-screen,
html.tablet-page .tablet-avatar-selection-screen,
html.tablet-page .tablet-session-end-screen,
html.tablet-page .tablet-connect-screen,
html.tablet-page .tablet-connection-screen {
    overflow: hidden !important;
    touch-action: none;
}

/* Legacy support - if html/body don't have tablet-page class */
html:has(.tablet-welcome-screen),
html:has(.tablet-capture-screen):not(:has(.category-container)):not(:has(.items-container)),
html:has(.tablet-preview-screen),
html:has(.tablet-process-screen),
html:has(.tablet-results-screen),
html:has(.tablet-profile-screen),
html:has(.tablet-avatar-selection-screen),
html:has(.tablet-session-end-screen),
html:has(.tablet-connect-screen),
html:has(.tablet-connection-screen) {
    overflow: hidden !important;
    height: 100vh !important;
    max-height: 100vh !important;
    touch-action: none;
}

body:has(.tablet-welcome-screen),
body:has(.tablet-capture-screen):not(:has(.category-container)):not(:has(.items-container)),
body:has(.tablet-preview-screen),
body:has(.tablet-process-screen),
body:has(.tablet-results-screen),
body:has(.tablet-profile-screen),
body:has(.tablet-avatar-selection-screen),
body:has(.tablet-session-end-screen),
body:has(.tablet-connect-screen),
body:has(.tablet-connection-screen) {
    overflow: hidden !important;
    height: 100vh !important;
    max-height: 100vh !important;
    position: fixed !important;
    width: 100% !important;
    touch-action: none;
}

/* Tablet Screen Base */
.tablet-screen-base {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow: hidden;
    padding: 0;
    margin: 0;
    box-sizing: border-box;
    touch-action: none;
}

/* Background Container */
.bg-container,
.tablet-bg-container {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    padding: 0px;
    isolation: isolate;
    position: fixed !important;
    width: 100vw !important;
    width: 100dvw !important; /* Dynamic viewport width for mobile browsers */
    height: 100vh !important;
    height: 100dvh !important; /* Dynamic viewport height for mobile browsers */
    min-height: 100vh !important;
    min-height: 100dvh !important;
    max-height: 100vh !important;
    max-height: 100dvh !important;
    left: 0px !important;
    top: 0px !important;
    right: 0px !important;
    bottom: 0px !important;
    /* Main Gradient - Full bleed - Always fills screen */
    background: linear-gradient(227.26deg, #C2D1FF -7.67%, #FFFFFF 65.55%) !important;
    background-size: 100% 100% !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    border-radius: 0px;
    flex: none;
    order: 0;
    flex-grow: 0;
    z-index: 0 !important;
    margin: 0 !important;
    overflow: hidden;
    /* Ensure it always covers the full viewport */
    box-sizing: border-box;
    /* Prevent any transform or positioning that could affect fixed positioning */
    transform: none !important;
}

/* Blob Elements */
.blob-1,
.blob-2 {
    position: absolute !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: none;
    background-repeat: no-repeat !important;
    background-size: contain !important;
    flex: none;
    order: 0;
    flex-grow: 0;
    z-index: 1 !important; /* Above gradient background, below content */
}

.blob-1 {
    width: 749.27px;
    height: 592.41px;
    left: -253px;
    top: 280px;
    background: url(/uploads/assets/rb_112211.png) !important;
    filter: blur(100.945px);
    transform: rotate(49.86deg);
}

.blob-2 {
    width: 749.27px;
    height: 592.41px;
    left: 866px;
    top: -543px;
    background: url(/uploads/assets/rb_112211.png) !important;
    filter: blur(100.945px);
    transform: rotate(49.86deg);
}

/* Ensure blobs are visible on category and items pages - same as profile */
.category-container .bg-container .blob-1,
.category-container .bg-container .blob-2,
.items-container .bg-container .blob-1,
.items-container .bg-container .blob-2 {
    position: absolute !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    z-index: 1 !important;
    pointer-events: none !important;
    background-repeat: no-repeat !important;
    background-size: contain !important;
}

/* Common Header */
[class*="-container"]:not(.welcome-container) .header,
.category-container .header,
.preview-container .header,
.items-container .header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: clamp(12px, 1.17vw, 16px) clamp(20px, 2.34vw, 32px);
    gap: clamp(40px, 5.2vw, 71px);
    position: fixed;
    height: clamp(56px, 7vh, 72px);
    left: 0px;
    right: 0px;
    top: 0px;
    width: 100vw;
    max-width: 100vw;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    flex: none;
    order: 1;
    flex-grow: 0;
    z-index: 100;
    box-sizing: border-box;
    margin: 0;
}

.welcome-container .header {
    position: absolute !important;
    width: 100% !important;
    max-width: 100% !important;
    left: 0 !important;
    right: 0 !important;
    top: 0 !important;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    height: 40px !important;
    padding: 0px !important;
    gap: 71px !important;
}

[class*="-container"] .header .logo,
.category-container .header .logo,
.preview-container .header .logo,
.items-container .header .logo {
    flex: none;
    order: 0;
    flex-grow: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    height: 40px;
    overflow: visible;
}

[class*="-container"] .header .logo-icon,
.category-container .header .logo-icon,
.preview-container .header .logo-icon,
.items-container .header .logo-icon {
    height: clamp(32px, 3.9vh, 40px);
    width: auto;
    max-width: clamp(160px, 15vw, 204.33px);
    opacity: 1;
    object-fit: contain;
    display: block;
}

[class*="-container"] .header .switcher,
.category-container .header .switcher,
.preview-container .header .switcher,
.items-container .header .switcher {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0px;
    gap: clamp(4px, 0.44vw, 6px);
    width: clamp(70px, 6.2vw, 85px);
    height: clamp(26px, 2.9vh, 30px);
    flex: none;
    order: 1;
    flex-grow: 0;
    background: transparent;
    border: none;
    cursor: pointer;
}

[class*="-container"] .header .switcher:hover,
.category-container .header .switcher:hover,
.preview-container .header .switcher:hover,
.items-container .header .switcher:hover {
    opacity: 0.8;
}

[class*="-container"] .header .switcher .lang-btn,
.category-container .header .switcher .lang-btn,
.preview-container .header .switcher .lang-btn,
.items-container .header .switcher .lang-btn {
    width: clamp(45px, 4vw, 55px);
    height: clamp(26px, 2.9vh, 30px);
    font-family: 'Cairo', sans-serif;
    font-style: normal;
    font-weight: 600;
    font-size: clamp(16px, 1.46vw, 20px);
    line-height: 150%;
    color: #000000;
    flex: none;
    order: 0;
    flex-grow: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

[class*="-container"] .header .switcher .lang-btn.active,
.category-container .header .switcher .lang-btn.active,
.preview-container .header .switcher .lang-btn.active,
.items-container .header .switcher .lang-btn.active {
    display: none;
}

[class*="-container"] .header .switcher .lang-btn:not(.active),
.category-container .header .switcher .lang-btn:not(.active),
.preview-container .header .switcher .lang-btn:not(.active),
.items-container .header .switcher .lang-btn:not(.active) {
    display: flex;
}

[class*="-container"] .header .switcher .globe-icon,
.category-container .header .switcher .globe-icon,
.preview-container .header .switcher .globe-icon,
.items-container .header .switcher .globe-icon {
    width: clamp(20px, 1.76vw, 24px);
    height: clamp(20px, 1.76vw, 24px);
    flex: none;
    order: 1;
    flex-grow: 0;
    object-fit: contain;
}

/* Alternative Header */
.tablet-header {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 0px clamp(16px, 2.5vw, 32px);
    gap: clamp(16px, 5vw, 71px);
    position: absolute;
    height: auto;
    min-height: clamp(40px, 6vh, 72px);
    max-height: 72px;
    left: 0px;
    right: 0px;
    top: 0px;
    flex: none;
    order: 1;
    flex-grow: 0;
    z-index: 10;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Logo */
.tablet-header .tablet-logo {
    flex: none;
    order: 0;
    flex-grow: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    height: auto;
    min-height: clamp(30px, 4.5vh, 40px);
    max-height: 40px;
    overflow: visible;
}

.tablet-header .tablet-logo-icon {
    height: auto;
    min-height: clamp(30px, 4.5vh, 40px);
    max-height: 40px;
    width: auto;
    max-width: clamp(150px, 15vw, 204px);
    opacity: 1;
    object-fit: contain;
    display: block;
}

.tablet-header .tablet-switcher {
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0px;
    gap: clamp(4px, 0.75vw, 6px);
    width: auto;
    min-width: clamp(70px, 10vw, 85px);
    max-width: 85px;
    height: auto;
    min-height: clamp(28px, 4vh, 30px);
    max-height: 30px;
    flex: none;
    order: 1;
    flex-grow: 0;
    background: transparent;
    border: none;
    cursor: pointer;
}

.tablet-header .tablet-switcher:hover {
    opacity: 0.8;
}

.tablet-header .tablet-switcher .tablet-lang-btn {
    width: auto;
    min-width: clamp(45px, 8vw, 55px);
    max-width: 55px;
    height: auto;
    min-height: clamp(28px, 4vh, 30px);
    max-height: 30px;
    font-family: 'Cairo', sans-serif;
    font-style: normal;
    font-weight: 600;
    font-size: clamp(16px, 2.5vw, 20px);
    line-height: 150%;
    color: #000000;
    flex: none;
    order: 0;
    flex-grow: 0;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tablet-header .tablet-switcher .tablet-lang-btn.active {
    display: none;
}

.tablet-header .tablet-switcher .tablet-lang-btn:not(.active) {
    display: flex;
}

.tablet-header .tablet-switcher .tablet-globe-icon {
    width: auto;
    min-width: clamp(20px, 3vw, 24px);
    max-width: 24px;
    height: auto;
    min-height: clamp(20px, 3vw, 24px);
    max-height: 24px;
    flex: none;
    order: 1;
    flex-grow: 0;
    object-fit: contain;
    display: block;
    position: relative;
}

/* RTL Support */
.tablet-screen-base[dir="rtl"] .tablet-header {
    flex-direction: row-reverse;
}

.tablet-screen-base[dir="rtl"] .tablet-header .tablet-logo {
    order: 2;
}

.tablet-screen-base[dir="rtl"] .tablet-header .tablet-switcher {
    order: 1;
}

.tablet-screen-base[dir="rtl"] .tablet-header .tablet-switcher .tablet-lang-btn {
    text-align: right;
}

/* Header with Connection Status */
.tablet-header-with-connection .tablet-header-right {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 16px;
}

.tablet-connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 12px;
    background: transparent;
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: #45556C;
    border: none;
}

.tablet-status-icon {
    font-size: 16px;
    color: #10B981;
}

.tablet-status-icon.disconnected {
    color: #DC2626;
}

.tablet-screen-name {
    font-weight: 500;
    font-size: 13px;
}

/* Content Area */
.tablet-content-area {
    position: relative;
    z-index: 5;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
}

/* No Scrolling on Non-Category/Items Screens */
.tablet-welcome-screen,
.tablet-capture-screen,
.tablet-preview-screen,
.tablet-process-screen,
.tablet-results-screen,
.tablet-profile-screen,
.tablet-avatar-selection-screen,
.tablet-session-end-screen,
.tablet-connect-screen,
.tablet-connection-screen {
    overflow: hidden !important;
    touch-action: none !important;
    /* Ensure fixed positioning */
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
}

.tablet-category-screen,
.tablet-items-screen {
    overflow: hidden !important;
    touch-action: none !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
}

.tablet-category-screen .category-container,
.tablet-items-screen .items-container {
    touch-action: pan-y !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

/* ========================================
   16:10 ASPECT RATIO SUPPORT (Honor Pad 10, etc.)
   ======================================== */

/* 16:10 Aspect Ratio (1.6:1) - Common tablet/laptop screens */
/* Examples: Honor Pad 10 (1920x1200), 2560x1600, 1280x800, 1600x1000 */
@media screen and (min-aspect-ratio: 15/10) and (max-aspect-ratio: 17/10) {
    /* Ensure all tablet screens use full viewport */
    .tablet-welcome-screen,
    .tablet-capture-screen,
    .tablet-category-screen,
    .tablet-results-screen,
    .tablet-preview-screen,
    .tablet-process-screen,
    .tablet-profile-screen,
    .tablet-avatar-selection-screen,
    .tablet-session-end-screen,
    .tablet-connect-screen,
    .tablet-connection-screen,
    .tablet-screen-base {
        width: 100vw;
        height: 100vh;
        min-height: 100vh;
        max-height: 100vh;
        overflow-x: hidden;
    }
    
    .bg-container,
    .tablet-bg-container {
        width: 100vw;
        height: 100vh;
        background-size: cover;
        background-position: center;
        background-repeat: no-repeat;
    }
    
    .blob-1 {
        width: clamp(749.27px, 39vw, 900px);
        height: clamp(592.41px, 31vh, 710px);
        left: clamp(-253px, -13.2vw, -300px);
        top: clamp(200px, 20vh, 350px);
    }
    
    .blob-2 {
        width: clamp(749.27px, 39vw, 900px);
        height: clamp(592.41px, 31vh, 710px);
        left: clamp(866px, 45.1vw, 1400px);
    }
    
    [class*="-container"]:not(.welcome-container) .header,
    .category-container .header,
    .preview-container .header,
    .items-container .header,
    .tablet-header {
        padding: clamp(14px, 2vh, 18px) clamp(24px, 2.5vw, 32px);
        height: auto;
        min-height: clamp(60px, 8vh, 75px);
    }
    
    .welcome-container,
    .capture-content,
    .category-content,
    .results-content,
    .preview-content,
    .process-content,
    .profile-content,
    .avatar-content,
    .connection-content {
        max-width: 100%;
        width: 100%;
        padding-left: clamp(24px, 2.5vw, 48px);
        padding-right: clamp(24px, 2.5vw, 48px);
        box-sizing: border-box;
    }
    
    .main-container {
        max-width: clamp(1200px, 90vw, 1366px);
        width: 100%;
        padding-left: clamp(48px, 4vw, 120px);
        padding-right: clamp(48px, 4vw, 120px);
        margin: 0 auto;
}

    /* Enhanced spacing for 16:10 screens */
    .category-container,
    .items-container {
        padding-top: clamp(72px, 9vh, 90px);
        padding-bottom: clamp(24px, 3vh, 32px);
    }
}

/* Large Screens */
@media screen and (min-width: 1920px) {
    .bg-container,
    .tablet-bg-container {
        width: 100vw;
        height: 100vh;
        background-size: cover;
        background-position: center;
    }
    
    .blob-1 {
        width: clamp(749.27px, 39vw, 900px);
        height: clamp(592.41px, 57.8vh, 710px);
        left: clamp(-253px, -13.2vw, -300px);
        filter: blur(clamp(100.945px, 5.3vw, 120px));
    }
    
    .blob-2 {
        width: clamp(749.27px, 39vw, 900px);
        height: clamp(592.41px, 57.8vh, 710px);
        left: clamp(866px, 45.1vw, 1400px);
        filter: blur(clamp(100.945px, 5.3vw, 120px));
    }
    
    [class*="-container"]:not(.welcome-container) .header,
    .category-container .header,
    .preview-container .header,
    .items-container .header {
        padding: clamp(16px, 0.83vw, 20px) clamp(32px, 1.67vw, 40px);
        gap: clamp(71px, 3.7vw, 85px);
    }
}
