/* Layout CSS - App Container, Header, and Navigation */

/* Main App Container */
#app-container {
    width: 100%;
    max-width: 420px;
    height: 850px;
    max-height: 90vh;
    background-color: var(--primary-bg);
    background-image: url('../assets/background.webp');
    background-size: cover;
    background-position: center;
    border: 2px solid var(--accent-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-glow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    -webkit-user-select: none; /* Safari */
    -ms-user-select: none; /* IE 10+ */
    user-select: none; /* Standard syntax */
    touch-action: manipulation;
}

#main-content {
    display: flex;
    flex-direction: column;
    /* This makes the content wrapper fill the available space */
    flex-grow: 1; 
    /* This prevents layout issues and is important for child elements */
    overflow: hidden; 
}

/* App Header */
#app-header {
    padding: var(--spacing-lg);
    text-align: center;
    background: linear-gradient(180deg, rgba(10, 10, 10, 0.9) 0%, rgba(10, 10, 10, 0) 100%);
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#page-title {
    font-family: var(--font-header);
    font-size: 1.5rem;
    color: var(--accent-color);
    text-shadow: 0 0 10px var(--glow-color);
    text-transform: uppercase;
}
/*Authentification*/

#user-profile-container {
    flex-shrink: 0; /* Prevents the container from shrinking */
}

#user-profile-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background-color: rgba(0,0,0,0.4);
    cursor: pointer;
    transition: all var(--transition-normal);
}

#user-profile-button img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

#user-profile-button.logged-out {
    filter: grayscale(0%);
    opacity: 1;
}

#user-profile-button.logged-in {
    border-color: var(--accent-color);
    box-shadow: 0 0 8px var(--glow-color);
}

#user-profile-button:hover {
    opacity: 1;
    border-color: var(--accent-color);
}


/* Page Content Area */
#page-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0 var(--spacing-lg) var(--spacing-lg);
    position: relative;
}

.contact-link {
    color: var(--accent-color);
    text-decoration: none;
}
.contact-link:hover {
    color:#ffaf33;
}

/* Page Base Styles */
.page {
    display: none;
    animation: fadeIn var(--transition-slow) ease-in-out;
}

.page.active {
    display: block;
}

.page h2 {
    font-family: var(--font-header);
    color: var(--text-color);
    margin-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: var(--spacing-sm);
}

.page p {
    font-size: 0.95rem;
    margin-bottom: var(--spacing-sm);
}

/* Bottom Navigation */
#tab-bar {
    display: flex;
    justify-content: space-around;
    background-color: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--accent-color);
    flex-shrink: 0;
    z-index: var(--z-navigation);
}

.tab-button {
    background: none;
    border: none;
    color: var(--text-color);
    flex-grow: 1;
    padding: var(--spacing-sm) var(--spacing-xs);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 600;
    transition: color var(--transition-normal), transform var(--transition-fast);
    border-top: 3px solid transparent;
}

.tab-button:hover {
    color: var(--accent-color);
    transform: translateY(-2px);
}

.tab-button.active {
    color: var(--accent-color);
    border-top-color: var(--accent-color);
    text-shadow: 0 0 5px var(--glow-color);
}

.tab-button img {
    width: 35px;
    height: 35px;
    margin-bottom: var(--spacing-xs);
    filter: grayscale(100%) brightness(1.5);
    transition: filter var(--transition-normal);
}

.tab-button:hover img,
.tab-button.active img {
    filter: none;
}

/* Responsive Adjustments */
@media (max-height: 700px) {
    #app-container {
        height: 95vh;
    }
    
    #app-header {
        padding: var(--spacing-md);
    }
    
    #page-title {
        font-size: 1.3rem;
    }
    
    .tab-button {
        padding: var(--spacing-xs);
        font-size: 0.65rem;
    }
    
    .tab-button img {
        width: 24px;
        height: 24px;
    }
}

@media (max-width: 380px) {
    #app-container {
        max-width: 95vw;
        margin: var(--spacing-sm);
    }
    
    #page-content {
        padding: 0 var(--spacing-md) var(--spacing-md);
    }
}

/* ---
  GLOBAL MODAL SIZING FIX
  This ensures any modal overlay inside the app container fills the frame.
--- */

#app-container > #modal-overlay,
#app-container > #selection-modal-overlay {
    position: absolute; /* Position relative to the app-container */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: var(--radius-xl); /* Match the app-container's border radius */
    overflow: hidden;
}

/* Force the inner containers to also fill the overlay */
#app-container > #modal-overlay > #modal-container,
#app-container > #selection-modal-overlay > #selection-modal-container {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    border-radius: 0;
    border: none;
    box-shadow: none;
    background: transparent;
}

/* Contains the skill detail modal within the app frame */
#app-container > #skill-detail-overlay {
    position: absolute;
}

/* Add this to the end of layout.css */
@media (max-width: 768px) {
    body {
        padding: 0;
    }

    #app-container {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border: none;
        border-radius: 0;
        box-shadow: none;
    }
    #tab-bar {
        padding-bottom: var(--spacing-xs);
    }
}

#ad-blocker-bait {
    /* This makes the element exist in the layout but be invisible to the user */
    height: 1px;
    width: 1px;
    position: absolute;
    bottom: -10px;
    left: -10px;
    opacity: 0;
    pointer-events: none;
}

/* --- App Lock Overlay (Anti-Adblock) --- */
.app-lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 10, 10, 0.95);
    z-index: 9999; /* Increased to be on top of the loading screen */
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 20px;
    border-radius: var(--radius-xl);
}

.app-lock-content h2 {
    font-family: var(--font-header);
    font-size: 1.5rem;
    color: var(--accent-color);
    margin-bottom: var(--spacing-md);
}

.app-lock-content p {
    font-family: var(--font-body);
    color: var(--text-color);
    line-height: 1.6;
    margin-bottom: var(--spacing-md);
}

.app-lock-content .support-text {
    font-size: 0.8rem;
    color: #888;
}

/* --- Fix for Search Bar Clear Button on iOS and Android --- */

input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  height: 20px;
  width: 20px;
  
  /* MODIFIED: The fill color has been changed from %23FFF (white) to %23ff9900 (orange) */
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ff9900'%3e%3cpath d='M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'/%3e%3c/svg%3e");
  
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  opacity: 0.7;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

input[type="search"]::-webkit-search-cancel-button:hover {
  opacity: 1;
}