/* ============================================================
   IAM Meet — estilos propios
   ============================================================ */

:root {
    --color-bg: #0a1929;
    --color-surface: #122237;
    --color-surface-2: #1a2e47;
    --color-primary: #3b82f6;
    --color-primary-hover: #8b5cf6;
    --color-accent: #f59e0b;
    --color-danger: #ef4444;
    --color-danger-hover: #f87171;
    --color-text: #f1f5f9;
    --color-text-dim: #94a3b8;
    --color-border: #2c3e50;

    --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    --gradient-primary-hot: linear-gradient(135deg, #f97316 0%, #ec4899 100%);
    --gradient-surface: linear-gradient(135deg, #1a2e47 0%, #122237 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
    --gradient-danger-hot: linear-gradient(135deg, #f97316 0%, #ef4444 100%);
    --gradient-glass: linear-gradient(135deg, rgba(255,255,255,0.18) 0%, rgba(255,255,255,0.05) 100%);

    --shadow-float: 0 10px 30px rgba(0, 0, 0, 0.35), 0 4px 8px rgba(0, 0, 0, 0.20);
    --shadow-float-hover: 0 18px 40px rgba(0, 0, 0, 0.45), 0 8px 16px rgba(0, 0, 0, 0.25);
    --shadow-glow-primary: 0 10px 32px rgba(59, 130, 246, 0.50);
    --shadow-glow-accent: 0 10px 32px rgba(236, 72, 153, 0.55);
    --shadow-glow-danger: 0 10px 32px rgba(239, 68, 68, 0.50);

    --radius: 8px;
    --radius-sm: 4px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html, body {
    height: 100%;
    background: var(--color-bg);
    color: var(--color-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

.hidden { display: none !important; }

/* ====================== Welcome ====================== */

.welcome {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    text-align: center;
    background-color: #0a1929;
    background-image: linear-gradient(to bottom, rgba(10, 25, 41, 0.10) 0%, rgba(10, 25, 41, 0.10) 55%, rgba(10, 25, 41, 0.75) 100%), url('/img/logo.png');
    background-size: 140%;
    background-position: center center;
    background-repeat: no-repeat;
}

.welcome-lang {
    position: relative;
    margin-top: 1.25rem;
    z-index: 10;
}

.welcome-lang-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--gradient-glass);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.30);
    padding: 10px 20px;
    border-radius: 999px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-float);
    transition: all var(--transition);
}

.welcome-lang-btn:hover {
    background: linear-gradient(135deg, rgba(59,130,246,0.45) 0%, rgba(236,72,153,0.45) 100%);
    border-color: rgba(255, 255, 255, 0.55);
    transform: translateY(-2px);
    box-shadow: var(--shadow-float-hover), 0 8px 24px rgba(139, 92, 246, 0.45);
}

.welcome-lang-caret { font-size: 0.7rem; opacity: 0.85; }

.welcome-lang-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
    min-width: 180px;
    text-align: left;
}

.welcome-lang-opt {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    color: var(--color-text);
    padding: 10px 16px;
    cursor: pointer;
    font-size: 0.95rem;
}

.welcome-lang-opt:hover { background: var(--color-surface-2); }
.welcome-lang-opt.active { color: var(--color-primary); font-weight: 600; }

.welcome-header { margin-bottom: 2.5rem; }

.welcome-logo { display: none; }

.welcome h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
    background: linear-gradient(
        90deg,
        #3b82f6 0%,
        #8b5cf6 20%,
        #ec4899 40%,
        #f59e0b 60%,
        #10b981 80%,
        #3b82f6 100%
    );
    background-size: 300% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    filter: drop-shadow(0 4px 14px rgba(0, 0, 0, 0.75));
    animation:
        title-color 8s linear infinite,
        title-float 4s ease-in-out infinite;
}

@keyframes title-color {
    0%   { background-position: 0% 50%; }
    100% { background-position: 300% 50%; }
}

@keyframes title-float {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-10px); }
}

.tagline {
    color: rgba(255, 255, 255, 0.92);
    font-size: 1.1rem;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
}

.join-form {
    width: 100%;
    max-width: 420px;
    background: var(--color-surface);
    padding: 2rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.join-form label {
    text-align: left;
    color: var(--color-text-dim);
    font-size: 0.875rem;
    font-weight: 500;
}

.join-form input[type="text"] {
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: 0.875rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    transition: border-color var(--transition);
}

.join-form input[type="text"]:focus {
    outline: none;
    border-color: var(--color-primary);
}

.btn {
    border: none;
    border-radius: 999px;
    padding: 0.95rem 2.2rem;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: all var(--transition);
    position: relative;
}

.btn-primary {
    background: var(--gradient-primary);
    background-size: 200% 200%;
    background-position: 0% 0%;
    color: white;
    box-shadow: var(--shadow-float), var(--shadow-glow-primary);
}

.btn-primary:hover {
    background-image: var(--gradient-primary-hot);
    background-position: 100% 100%;
    box-shadow: var(--shadow-float-hover), var(--shadow-glow-accent);
    transform: translateY(-3px);
}

.btn-primary:active { transform: translateY(-1px) scale(0.98); }

.welcome-note {
    margin-top: 2rem;
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.95rem;
    max-width: 420px;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.85);
}

/* ====================== Meeting ====================== */

.meeting {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--color-bg);
}

.video-grid {
    flex: 1;
    display: grid;
    gap: 8px;
    padding: 8px;
    overflow: auto;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    grid-auto-rows: minmax(180px, 1fr);
    align-content: start;
}

.video-tile {
    position: relative;
    background: var(--color-surface);
    border-radius: var(--radius);
    overflow: hidden;
    aspect-ratio: 16 / 9;
}

.video-tile video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

.video-tile.local video { transform: scaleX(-1); }

.video-tile-label {
    position: absolute;
    left: 8px;
    bottom: 8px;
    padding: 4px 10px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 0.85rem;
    border-radius: var(--radius-sm);
    pointer-events: none;
}

.video-tile-mic-off {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 4px;
    background: var(--color-danger);
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

/* ====================== Toolbar ====================== */

.toolbar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--color-surface);
    border-top: 1px solid var(--color-border);
}

.toolbar-brand-img {
    height: 56px;
    width: 56px;
    object-fit: contain;
    margin-right: 24px;
}

.tool-btn {
    width: 56px;
    height: 56px;
    border: none;
    border-radius: 50%;
    background: var(--gradient-surface);
    color: var(--color-text);
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    box-shadow: var(--shadow-float);
}

.tool-btn:hover {
    background: var(--gradient-primary);
    transform: translateY(-3px);
    box-shadow: var(--shadow-float-hover), var(--shadow-glow-primary);
}

.tool-btn:active { transform: translateY(-1px) scale(0.95); }

.tool-btn.off {
    background: var(--gradient-danger);
    box-shadow: var(--shadow-float), var(--shadow-glow-danger);
}

.tool-btn.off:hover {
    background: var(--gradient-danger-hot);
    box-shadow: var(--shadow-float-hover), 0 10px 32px rgba(249, 115, 22, 0.55);
}

.tool-btn-danger {
    background: var(--gradient-danger);
    box-shadow: var(--shadow-float), var(--shadow-glow-danger);
}

.tool-btn-danger:hover {
    background: var(--gradient-danger-hot);
    transform: translateY(-3px);
    box-shadow: var(--shadow-float-hover), 0 12px 36px rgba(249, 115, 22, 0.60);
}

.tool-btn .icon {
    font-size: 1.5rem;
    line-height: 1;
    font-weight: 700;
}

/* ====================== Selector de idioma ====================== */

.lang-wrap {
    position: relative;
}

#btn-lang .icon {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.lang-menu {
    position: absolute;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-surface-2);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 6px;
    min-width: 170px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 50;
}

.lang-opt {
    background: none;
    border: none;
    color: var(--color-text);
    padding: 10px 12px;
    text-align: left;
    cursor: pointer;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: background var(--transition);
}

.lang-opt:hover { background: var(--color-primary); }

.lang-opt.active {
    background: var(--color-primary);
    font-weight: 600;
}

/* ====================== Meeting info ====================== */

.meeting-info {
    position: fixed;
    top: 16px;
    left: 16px;
    padding: 8px 12px;
    background: rgba(10, 25, 41, 0.85);
    border-radius: var(--radius-sm);
    color: var(--color-text-dim);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 12px;
    backdrop-filter: blur(8px);
}

#room-name-display {
    color: var(--color-text);
    font-weight: 600;
}

.btn-link {
    background: none;
    border: none;
    color: var(--color-primary);
    cursor: pointer;
    font-size: 0.875rem;
    text-decoration: underline;
}

.btn-link:hover { color: var(--color-primary-hover); }

/* ====================== Subtitles ====================== */

.subtitles {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 80%;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 1.5rem;
    text-align: center;
    border-radius: var(--radius-sm);
    line-height: 1.4;
    backdrop-filter: blur(8px);
    pointer-events: none;
}

/* ====================== Toast ====================== */

.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-surface);
    color: var(--color-text);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow);
    z-index: 100;
    font-size: 0.875rem;
}

/* ====================== Mobile ====================== */

@media (max-width: 600px) {
    .welcome { padding: 1rem; }
    .welcome-logo { width: 240px; height: auto; }
    .welcome h1 { font-size: 1.5rem; }
    .video-grid { grid-template-columns: 1fr; padding: 4px; gap: 4px; }
    .toolbar { padding: 12px 8px; gap: 8px; }
    .toolbar-brand-img { height: 44px; width: 44px; margin-right: 12px; }
    .tool-btn { width: 48px; height: 48px; }
    .tool-btn .icon { font-size: 1.25rem; }
    .meeting-info { font-size: 0.75rem; }
    .subtitles { font-size: 1rem; bottom: 90px; padding: 8px 16px; }
}
