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

:root {
    --primary-color: #0891b2;
    --primary-hover: #0e7490;
    --secondary-color: #06b6d4;
    --success-color: #10b981;
    --error-color: #ef4444;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --border-color: #e2e8f0;
    --bg-body: #f1f5f9;
    --shadow: 0 2px 4px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.08), 0 4px 8px rgba(0, 0, 0, 0.04);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #164e63 0%, #0e7490 30%, #155e75 60%, #1e293b 100%);
    background-attachment: fixed;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
}

.portal-card {
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 28px 24px;
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
    animation: fadeInUp 0.6s ease-out;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.portal-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.25), 0 6px 12px rgba(0, 0, 0, 0.15);
}


.logo-section {
    text-align: center;
    /* margin-bottom: 32px; */
}

.splash-logo,
#splashLogo {
    width: 160px !important;
    height: 80px !important;
    max-width: 160px !important;
    max-height: 80px !important;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.wifi-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 12px;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.wifi-icon svg {
    width: 100%;
    height: 100%;
}

.logo-section h1 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

.connection-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    display: inline-block;
    animation: pulse-dot 2s ease-in-out infinite;
}

.connection-status.connected .status-dot {
    background: var(--success-color);
    animation: none;
}

.connection-status.connecting .status-dot {
    background: var(--secondary-color);
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

.form-section {
    margin-top: 24px;
}

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

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.form-group input[type="text"],
.form-group input[type="password"] {
    width: 100%;
    padding: 10px 14px;
    padding-right: 40px;
    border: 1.5px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--bg-primary);
    color: var(--text-primary);
}

.password-wrapper input[type="password"] {
    padding-right: 48px;
}

.form-group input[type="text"]:hover,
.form-group input[type="password"]:hover {
    border-color: rgba(8, 145, 178, 0.5);
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.15);
    transform: scale(1.01);
}

.password-toggle {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.password-toggle:hover {
    color: var(--primary-color);
}

.password-toggle:active {
    transform: scale(0.95);
}

.password-toggle:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 4px;
}

.password-toggle svg {
    width: 20px;
    height: 20px;
}

.eye-off-icon {
    display: none;
}

.password-toggle.active .eye-icon {
    display: none;
}

.password-toggle.active .eye-off-icon {
    display: block;
}

.form-group input.error {
    border-color: var(--error-color);
}

.error-message {
    display: block;
    color: var(--error-color);
    font-size: 12px;
    margin-top: 6px;
    min-height: 18px;
}

.checkbox-group {
    margin-bottom: 24px;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.5;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 2px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.checkbox-label a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.checkbox-label a:hover {
    text-decoration: underline;
}

.submit-btn {
    width: 100%;
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.submit-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
}

.submit-btn:hover:not(:disabled) {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(8, 145, 178, 0.35);
}

.submit-btn:hover:not(:disabled)::before {
    width: 300px;
    height: 300px;
}

.submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.submit-btn:focus-visible {
    outline: 3px solid rgba(8, 145, 178, 0.5);
    outline-offset: 2px;
}

.guest-btn:focus-visible {
    outline: 3px solid rgba(8, 145, 178, 0.5);
    outline-offset: 2px;
}

.btn-loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto;
}

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

.submit-btn.loading .btn-text {
    display: none;
}

.submit-btn.loading .btn-loader {
    display: block;
}

.alternative-auth {
    margin-top: 24px;
}

.divider {
    text-align: center;
    margin: 24px 0;
    position: relative;
}

.divider::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    right: 0;
    height: 1px;
    background: var(--border-color);
}

.divider span {
    background: var(--bg-primary);
    padding: 0 16px;
    color: var(--text-secondary);
    font-size: 14px;
    position: relative;
}

.guest-btn {
    width: 100%;
    padding: 10px 20px;
    background: transparent;
    color: var(--primary-color);
    border: 1.5px solid var(--primary-color);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.guest-btn:hover {
    background: var(--primary-color);
    color: white;
}

.status-message {
    margin-top: 20px;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    display: none;
    animation: fadeIn 0.3s ease-out;
}


.status-message.success {
    display: block;
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #10b981;
}

.status-message.error {
    display: block;
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #ef4444;
}

.footer {
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 12px;
}

/* Invalid URL Card Styles */
.invalid-url-card {
    text-align: center;
}

.invalid-url-card .wifi-icon {
    color: var(--error-color);
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: var(--bg-primary);
    border-radius: 12px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-body h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 16px;
    margin-bottom: 10px;
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 16px;
}

.modal-body ul {
    color: var(--text-secondary);
    line-height: 1.8;
    margin-left: 20px;
    margin-bottom: 16px;
}

.modal-body li {
    margin-bottom: 8px;
}

/* Loading Animation */

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .submit-btn,
    .guest-btn,
    .password-toggle {
        min-height: 42px;
        min-width: 44px;
    }
    
    .form-group input[type="text"],
    .form-group input[type="password"] {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 12px;
    }
    
    .container {
        max-width: 100%;
    }
    
    .portal-card {
        padding: 24px 20px;
        border-radius: 12px;
    }

    .logo-section h1 {
        font-size: 18px;
    }
    
    .wifi-icon {
        width: 40px;
        height: 40px;
    }
    
    .modal-content {
        margin: 10px;
        max-height: 90vh;
        border-radius: 12px;
    }
    
    .modal-header {
        padding: 20px;
    }
    
    .modal-body {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .portal-card {
        padding: 20px 16px;
    }

    .logo-section h1 {
        font-size: 18px;
    }
    
    .subtitle {
        font-size: 13px;
    }
    
    .form-group {
        margin-bottom: 18px;
    }
    
    .submit-btn,
    .guest-btn {
        padding: 12px 20px;
        font-size: 15px;
    }
    
    .checkbox-label {
        font-size: 13px;
    }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        padding: 10px;
    }
    
    .portal-card {
        padding: 24px 20px;
        max-width: 500px;
    }
    
    
    .wifi-icon {
        width: 48px;
        height: 48px;
        margin-bottom: 12px;
    }
    
    .logo-section h1 {
        font-size: 16px;
        margin-bottom: 4px;
    }
}

