@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600&display=swap');

:root {
    --primary-hue: 250;
    --primary: hsl(var(--primary-hue), 100%, 65%);
    --primary-dark: hsl(var(--primary-hue), 100%, 55%);
    --bg-dark: hsl(222, 47%, 11%);
    --bg-card: hsl(217, 33%, 17%);
    --text-main: hsl(210, 40%, 98%);
    --text-muted: hsl(215, 20%, 65%);
    --success: hsl(150, 60%, 50%);
    --danger: hsl(340, 70%, 50%);
    --glass: rgba(255, 255, 255, 0.05);
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 4px 30px rgba(0, 0, 0, 0.5);
    --radius: 12px;
}

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

img {
    max-width: 100%;
}

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

a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.3s;
}

a:hover {
    color: var(--primary-dark);
}

/* Header */
.main-header {
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.main-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    display: flex;
    align-items: center;
}

.logo img {
    height: 44px !important;
    width: auto !important;
    max-height: 44px !important;
    max-width: 200px !important;
    object-fit: contain;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.logo img:hover {
    transform: scale(1.05);
}

nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

nav a {
    color: var(--text-muted);
    font-weight: 500;
}

nav a:hover {
    color: white;
}

.nav-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.3s;
}

.nav-btn:hover {
    background: var(--glass);
    border-color: var(--primary);
}

/* Layout */
.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

main.container {
    flex: 1;
    padding: 2rem 1rem;
}

/* Footer */
footer {
    background: var(--bg-card);
    padding: 2rem 0;
    text-align: center;
    color: var(--text-muted);
    margin-top: auto;
    border-top: 1px solid var(--border);
}

/* Forms & Auth */
.auth-container,
.info-container,
.error-container {
    max-width: 400px;
    margin: 2rem auto;
    background: var(--bg-card);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

h2 {
    margin-bottom: 1.5rem;
    color: white;
}

.form-group {
    margin-bottom: 1.2rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 0.8rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: white;
    font-family: inherit;
    transition: border-color 0.3s;
}

input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-primary {
    display: block;
    width: 100%;
    padding: 0.8rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, background 0.3s;
    margin-top: 1rem;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.auth-links {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
}

/* Dashboard */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.btn-secondary {
    background: var(--glass);
    border: 1px solid var(--border);
    color: white;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.device-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}

.device-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    border-color: var(--primary);
}

.device-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    background: var(--glass);
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.device-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.status {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.status strong {
    color: var(--success);
}

.controls {
    display: flex;
    gap: 1rem;
}

.btn-control {
    flex: 1;
    padding: 0.6rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-control.open {
    background: var(--success);
    color: #00331f;
}

.btn-control.close {
    background: var(--danger);
    color: white;
}

.btn-control:hover {
    opacity: 0.9;
}

/* Messages */
.messages {
    list-style: none;
    margin-bottom: 1rem;
}

.messages li {
    padding: 1rem;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

.messages li.error {
    border-color: var(--danger);
    color: var(--danger);
}

.messages li.success {
    border-color: var(--success);
    color: var(--success);
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-container,
.device-card {
    animation: fadeIn 0.5s ease-out;
}