:root {
    --bg-color: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.8);
    --primary-blue: #3b82f6;
    --primary-teal: #0d9488;
    --primary-orange: #f59e0b;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --header-bg: #ffffff;
    --accent-gradient-blue: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
    --accent-gradient-teal: linear-gradient(135deg, #2dd4bf 0%, #0d9488 100%);
    --accent-gradient-orange: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --hover-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --transition: cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* Login Screen */
#login-screen {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(248, 250, 252, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s var(--transition);
}

.login-card {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 3rem;
    border-radius: 2rem;
    text-align: center;
    width: 440px;
    box-shadow: var(--card-shadow);
    animation: zoomIn 0.6s var(--transition);
}

@keyframes zoomIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.login-card .logo-large {
    width: 80px;
    height: 80px;
    background: var(--accent-gradient-blue);
    border-radius: 1.5rem;
    margin: 0 auto 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3);
}

.login-card h1 { font-size: 2.2rem; margin-bottom: 0.5rem; color: var(--text-main); }
.login-card p { color: var(--text-muted); margin-bottom: 2.5rem; line-height: 1.5; }

/* Main App Layout */
#main-app {
    display: none;
    opacity: 0;
    transition: opacity 1s var(--transition);
    flex-direction: column;
    height: 100vh;
    max-width: 100%;
    margin: 0 auto;
    width: 100%;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--header-bg);
    border-radius: 1rem;
    box-shadow: var(--card-shadow);
    margin: 1.5rem 2rem;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-blue);
}

.logo svg { width: 32px; height: 32px; }

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
    background: #f1f5f9;
    border-radius: 2rem;
}

.user-info { font-size: 0.9rem; font-weight: 500; }
.user-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    object-fit: cover;
}

.logout-btn {
    background: transparent;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 5px;
    display: flex;
    transition: transform 0.2s;
}
.logout-btn:hover { transform: scale(1.1); }

.btn-nav {
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid var(--primary-blue);
    color: var(--primary-blue);
    padding: 0.5rem 1.25rem;
    border-radius: 99px;
    cursor: pointer;
    font-weight: 600;
    display: none;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}
.btn-nav:hover { background: var(--primary-blue); color: white; }

#app-container {
    flex-grow: 1;
    position: relative;
    overflow-y: auto;
    padding: 0 2rem 2rem 2rem;
}

.launcher {
    transition: all 0.5s var(--transition);
}

.section-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.category-section { margin-bottom: 4rem; animation: fadeInUp 0.6s ease-out forwards; }
.category-section:nth-child(2) { animation-delay: 0.2s; }
.category-section:nth-child(3) { animation-delay: 0.4s; }

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
}

.app-card {
    background: var(--card-bg);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: var(--card-shadow);
    transition: all 0.3s var(--transition);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.app-card:hover { transform: translateY(-8px); box-shadow: var(--hover-shadow); border-color: rgba(59, 130, 246, 0.3); }

.app-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; width: 100%; height: 6px;
    transition: height 0.3s ease;
}

.app-card.structural::before { background: var(--accent-gradient-blue); }
.app-card.bridge::before { background: var(--accent-gradient-teal); }
.app-card.design::before { background: var(--accent-gradient-orange); }

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    align-self: flex-start;
}

.badge-blue { background: #eff6ff; color: #1d4ed8; }
.badge-teal { background: #f0fdfa; color: #0f766e; }
.badge-orange { background: #fffbe6; color: #b45309; }

.app-icon {
    width: calc(100% + 4rem);
    margin-left: -2rem;
    margin-top: -2rem;
    height: 200px;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    color: var(--primary-blue);
    transition: all 0.3s ease;
    overflow: hidden;
}

.app-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.bridge .app-icon { color: var(--primary-teal); }
.design .app-icon { color: var(--primary-orange); }

.app-card:hover .app-icon img { transform: scale(1.05); }

.app-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.75rem; color: var(--text-main); }
.app-description { font-size: 0.95rem; color: var(--text-muted); margin-bottom: 2rem; flex-grow: 1; }

.launch-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--primary-blue);
    transition: gap 0.3s ease;
    margin-top: auto;
}

.bridge .launch-btn { color: var(--primary-teal); }
.design .launch-btn { color: var(--primary-orange); }

.app-card:hover .launch-btn { gap: 0.75rem; }

#iframe-host {
    position: absolute;
    top: 0; left: 2rem; width: calc(100% - 4rem); height: calc(100% - 2rem);
    border: none;
    display: none;
    opacity: 0;
    transition: opacity 0.5s ease;
    border-radius: 1rem;
    background: #fff;
    box-shadow: var(--card-shadow);
    z-index: 50;
}



@media (max-width: 768px) {
    header { margin: 1rem; padding: 1rem; flex-direction: column; gap: 1rem; }
    #app-container { padding: 0 1rem 1rem 1rem; }
    .apps-grid { grid-template-columns: 1fr; }
    #iframe-host { left: 1rem; width: calc(100% - 2rem); height: calc(100% - 1rem); }
    .modal-content-container { width: 100%; padding: 0 1rem; }
}
