/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */
* {
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    box-sizing: border-box;
}

body {
    -webkit-touch-callout: none;
    -webkit-text-size-adjust: none;
    -webkit-user-select: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    font-size: 14px;
    height: 100vh;
    margin: 0;
    padding: 0;
    padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
    width: 100%;
    overflow: hidden;
}

/* Login Wrapper with Animated Background */
.login-wrapper {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f62fe 0%, #2c6adf 45%, #051c59 100%);
    overflow: hidden;
}

.login-background {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    overflow: hidden;
    z-index: 1;
}

.wave {
    position: absolute;
    width: 200%;
    height: 200%;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 45%;
    animation: wave-animation 15s infinite linear;
}

.wave1 {
    top: -100%;
    left: -50%;
    animation-duration: 20s;
}

.wave2 {
    top: -120%;
    left: -50%;
    animation-duration: 25s;
    opacity: 0.5;
}

.wave3 {
    top: -140%;
    left: -50%;
    animation-duration: 30s;
    opacity: 0.3;
}

@keyframes wave-animation {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* Login Container */
.login-container {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 420px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 40px 35px;
    width: 100%;
    animation: slideUp 0.5s ease-out;
}

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

.logo-container {
    text-align: center;
    margin-bottom: 30px;
}

.logo-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
    margin-bottom: 10px;
    padding: 15px;
}

.logo {
    max-width: 70px;
    height: auto;
    filter: brightness(0) invert(1);
}

.login-header {
    text-align: center;
    margin-bottom: 35px;
}

.login-logo {
    max-width: 90px;
    height: auto;
    margin: 0 auto 16px;
    display: block;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: #0f172a;
    text-transform: none;
    letter-spacing: -0.5px;
}

.login-header .subtitle {
    font-size: 15px;
    color: #4b5a7a;
    margin: 0;
    text-transform: none;
}

.login-form {
    width: 100%;
}

.form-group {
    margin-bottom: 22px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    font-weight: 600;
    color: #2d3748;
    font-size: 14px;
    text-transform: none;
}

.input-icon {
    color: #0f62fe;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid rgba(15, 98, 254, 0.15);
    border-radius: 12px;
    font-size: 15px;
    transition: all 0.3s ease;
    -webkit-user-select: text;
    user-select: text;
    background: rgba(15, 98, 254, 0.04);
    color: #2d3748;
}

.form-group input:focus {
    outline: none;
    border-color: #0f62fe;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(15, 98, 254, 0.2);
}

.form-group input::placeholder {
    color: #7b8aa8;
}

.error-message {
    background: linear-gradient(135deg, #fed7d7 0%, #fc8181 100%);
    color: #c53030;
    padding: 14px;
    border-radius: 12px;
    margin-bottom: 20px;
    font-size: 14px;
    text-align: center;
    border: none;
    text-transform: none;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(197, 48, 48, 0.2);
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.login-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #0f62fe 0%, #1d4ed8 60%, #0b2f8c 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: none;
    position: relative;
    box-shadow: 0 15px 35px rgba(15, 98, 254, 0.35);
    overflow: hidden;
}

.login-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.login-btn:hover::before {
    left: 100%;
}

.login-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 18px 38px rgba(5, 28, 89, 0.45);
}

.login-btn:active {
    transform: translateY(0);
}

.login-btn:disabled {
    background: #cbd5e0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.login-btn .btn-text,
.login-btn .btn-loader {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.spinner {
    animation: spin 1s linear infinite;
}

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

@media (max-width: 480px) {
    body {
        font-size: 13px;
    }
    
    .login-container {
        padding: 16px;
    }
    
    .login-box {
        padding: 30px 22px;
        border-radius: 18px;
    }
    
    .login-logo {
        max-width: 80px;
        margin-bottom: 12px;
    }
    
    .login-header h1 {
        font-size: 24px;
    }
    
    .login-header .subtitle {
        font-size: 14px;
    }
    
    .form-group {
        margin-bottom: 18px;
    }
    
    .form-group input {
        padding: 12px 14px;
        font-size: 14px;
    }
    
    .login-btn {
        padding: 14px;
        font-size: 15px;
    }
}

/* Portrait layout (default) */
.app {
    background:url(../img/logo.png) no-repeat center top; /* 170px x 200px */
    position:absolute;             /* position in the center of the screen */
    left:50%;
    top:50%;
    height:50px;                   /* text area height */
    width:225px;                   /* text area width */
    text-align:center;
    padding:180px 0px 0px 0px;     /* image height is 200px (bottom 20px are overlapped with text) */
    margin:-115px 0px 0px -112px;  /* offset vertical: half of image height and text area height */
                                   /* offset horizontal: half of text area width */
}

/* Landscape layout (with min-width) */
@media screen and (min-aspect-ratio: 1/1) and (min-width:400px) {
    .app {
        background-position:left center;
        padding:75px 0px 75px 170px;  /* padding-top + padding-bottom + text area = image height */
        margin:-90px 0px 0px -198px;  /* offset vertical: half of image height */
                                      /* offset horizontal: half of image width and text area width */
    }
}

h1 {
    font-size:24px;
    font-weight:normal;
    margin:0px;
    overflow:visible;
    padding:0px;
    text-align:center;
}

.event {
    border-radius:4px;
    color:#FFFFFF;
    font-size:12px;
    margin:0px 30px;
    padding:2px 0px;
}

.event.listening {
    background-color:#333333;
    display:block;
}

.event.received {
    background-color:#4B946A;
    display:none;
}

#deviceready.ready .event.listening { display: none; }
#deviceready.ready .event.received { display: block; }

@keyframes fade {
    from { opacity: 1.0; }
    50% { opacity: 0.4; }
    to { opacity: 1.0; }
}

.blink {
    animation:fade 3000ms infinite;
    -webkit-animation:fade 3000ms infinite;
}


@media screen and (prefers-color-scheme: dark) {
    body {
        background-image:linear-gradient(to bottom, #585858 0%, #1B1B1B 51%);
    }
}
