:root {
    --iot-primary: #0066ff;
    --iot-secondary: #00d4ff;
    --iot-dark: #0a1428;
    --iot-light: #f8f9fa;
    --iot-accent: #ff6b35;
    --iot-success: #10b981;
    --iot-border: #e5e7eb;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body.iot-login-body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f0f2f5;
}

.iot-map-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.iot-map-background .leaflet-container {
    width: 100% !important;
    height: 100% !important;
    filter: grayscale(60%) opacity(0.8);
}

.iot-gradient-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 102, 255, 0.9) 0%, rgba(0, 212, 255, 0.85) 50%, rgba(255, 107, 53, 0.8) 100%);
    z-index: 1;
    pointer-events: none;
}

.iot-login-main {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 2rem 1rem;
}

.iot-login-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    max-width: 1200px;
    width: 100%;
    align-items: center;
}

.iot-login-left {
    color: white;
    padding: 2rem;
}

.iot-branding {
    margin-bottom: 4rem;
}

.iot-logo-circle {
    width: 80px;
    height: 80px;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
    margin-bottom: 1.5rem;
    animation: logoFloat 3s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.iot-branding h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}

.iot-branding p {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 300;
}

.iot-features {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 3rem;
}

.iot-feature {
    display: flex;
    align-items: center;
    gap: 1rem;
    opacity: 0.95;
    animation: slideInLeft 0.6s ease-out backwards;
}

.iot-feature:nth-child(1) { animation-delay: 0.1s; }
.iot-feature:nth-child(2) { animation-delay: 0.2s; }
.iot-feature:nth-child(3) { animation-delay: 0.3s; }

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.iot-feature i {
    font-size: 1.5rem;
    color: var(--iot-secondary);
    min-width: 30px;
}

.iot-feature span {
    font-size: 1rem;
    font-weight: 500;
}

.iot-login-right {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 0;
    animation: slideInRight 0.6s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.iot-login-form-container {
    padding: 3rem 2.5rem;
}

.iot-form-header {
    margin-bottom: 2.5rem;
    text-align: center;
}

.iot-form-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--iot-dark);
    margin-bottom: 0.5rem;
}

.iot-form-header p {
    color: #666;
    font-size: 0.95rem;
    font-weight: 500;
}

.iot-login-form {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.iot-form-group {
    margin-bottom: 1rem;
    position: relative;
}

.iot-form-group:last-of-type {
    margin-bottom: 1.5rem;
}

.iot-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--iot-border);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    background: #f8f9fa;
    color: var(--iot-dark);
    font-weight: 500;
}

.iot-input::placeholder {
    color: #999;
}

.iot-input:focus {
    outline: none;
    border-color: var(--iot-primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.iot-input:hover {
    border-color: var(--iot-primary);
    background: white;
}

.form-group label {
    display: none;
}

.errorMessage {
    color: #dc2626;
    font-size: 0.85rem;
    margin-top: 0.35rem;
    display: block;
    font-weight: 500;
}

.invalid-feedback {
    color: #dc2626;
    font-size: 0.85rem;
    margin-top: 0.35rem;
    display: block;
    font-weight: 500;
}

/* Error state for form groups */
.iot-form-group.has-error .iot-input {
    border-color: #dc2626;
    background-color: rgba(220, 38, 38, 0.05);
}

.iot-form-group.has-error .iot-input:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
    border-color: #dc2626;
}

.iot-form-group.has-error .iot-captcha-row img {
    border-color: #dc2626;
}

/* Focused state */
.iot-form-group.focused .iot-input {
    background: white;
}

.iot-captcha-wrapper {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.75rem;
    align-items: center;
}

.iot-captcha-image {
    border-radius: 6px;
    cursor: pointer;
    height: 38px;
    border: 1px solid var(--iot-border) !important;
}

.iot-captcha-input {
    min-width: 150px;
}

.iot-captcha-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.75rem;
    align-items: center;
    width: 100%;
}

.iot-captcha-row img {
    border-radius: 6px;
    cursor: pointer;
    height: 42px;
    border: 1px solid var(--iot-border);
    transition: all 0.3s ease;
}

.iot-captcha-row img:hover {
    border-color: var(--iot-primary);
    box-shadow: 0 0 0 2px rgba(0, 102, 255, 0.1);
}

.iot-captcha-txt {
    width: 100%;
    min-width: auto;
}

.iot-form-actions {
    display: flex;
    align-items: center;
    margin-bottom: 1.5rem;
}

.iot-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #555;
    font-weight: 500;
    margin: 0;
}

.iot-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--iot-primary);
    border: 1px solid var(--iot-border);
    border-radius: 4px;
}

.iot-submit-wrapper {
    width: 100%;
}

.iot-submit-btn {
    width: 100%;
    padding: 0.85rem 1.5rem;
    background: linear-gradient(135deg, var(--iot-primary) 0%, var(--iot-secondary) 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 10px 25px rgba(0, 102, 255, 0.3);
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
}

.iot-submit-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.iot-submit-btn:hover {
    box-shadow: 0 15px 35px rgba(0, 102, 255, 0.4);
    transform: translateY(-2px);
}

.iot-submit-btn:hover::before {
    width: 300px;
    height: 300px;
}

.iot-submit-btn:active {
    transform: translateY(0);
}

.iot-login-footer {
    margin-top: 2rem;
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--iot-border);
    color: #999;
    font-size: 0.8rem;
}

.alert {
    margin-bottom: 1.5rem;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    border: 1px solid;
    font-size: 0.9rem;
    font-weight: 500;
    animation: alertSlide 0.3s ease-out;
}

@keyframes alertSlide {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.alert-success {
    background-color: #d1fae5;
    border-color: #6ee7b7;
    color: #065f46;
}

.alert-danger {
    background-color: #fee2e2;
    border-color: #fca5a5;
    color: #7f1d1d;
}

.alert-warning {
    background-color: #fef3c7;
    border-color: #fde68a;
    color: #78350f;
}

.alert-info {
    background-color: #dbeafe;
    border-color: #93c5fd;
    color: #0c2340;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .iot-login-wrapper {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .iot-login-left {
        display: none;
    }

    .iot-login-right {
        max-width: 400px;
        margin: 0 auto;
    }
}

@media (max-width: 640px) {
    .iot-login-main {
        padding: 1rem;
    }

    .iot-login-right {
        max-width: 100%;
    }

    .iot-login-form-container {
        padding: 2rem 1.5rem;
    }

    .iot-form-header h1 {
        font-size: 1.5rem;
    }

    .iot-input {
        padding: 0.7rem 0.9rem;
        font-size: 0.9rem;
    }

    .iot-captcha-wrapper {
        grid-template-columns: 1fr;
    }

    .iot-captcha-image {
        width: 100%;
    }
}

/* Error state styling */
.iot-form-group.has-error .iot-input {
    border-color: #dc2626;
    background: rgba(220, 38, 38, 0.05);
}

.iot-form-group.has-error .iot-input:focus {
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* Loading state */
.iot-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none !important;
}

.iot-submit-btn.loading {
    position: relative;
    color: transparent;
}

.iot-submit-btn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
