/* General resets */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f5f6fa;
    color: #333;
    line-height: 1.6;
}

/* Header / Navbar */
header {
    background-color: #224e94;  /* darker blue */
    color: #ffffff;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between; /* push user-info to right */
    position: relative;
}

/* Left: hamburger + LockSync text */
.header-left {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

/* LockSync text */
.header-left h1 {
    font-size: 1.8rem;
    color: #ffffff;
}

/* Hamburger */
.hamburger {
    display: flex;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
}

.hamburger div {
    width: 25px;
    height: 3px;
    background-color: #ffffff;
    border-radius: 2px;
}

/* Right: user info */
.user-info {
    font-size: 0.95rem;
    white-space: nowrap;   /* prevent wrapping */
    text-align: right;
    color: #ffffff;
    max-width: 50%;        /* prevent overflow on very long names */
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Navigation links - hidden by default */
.nav-links {
    list-style: none;
    display: none;           /* hidden initially */
    flex-direction: column;
    gap: 1rem;
    position: absolute;
    top: 60px;               /* below header */
    left: 1rem;              /* align with hamburger */
    background-color: #224e94;
    padding: 1rem 2rem;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    border: 2px solid orange; /* new orange border */
    z-index: 1000;
}

/* Show when active */
.nav-links.active {
    display: flex;
}

/* Nav links styling */
.nav-links li a {
    text-decoration: none;
    color: #ffffff;
    font-weight: bold;
}

/* Hover effect */
.nav-links li a:hover {
    background-color: orange;
    color: #224e94; /* contrast with the dropdown background */
}

/* Flash messages / alerts */
.alert {
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border-radius: 6px;
    font-size: 0.95rem;
}

.alert-error {
    background-color: #ff6b6b;
    color: #fff;
}

.alert-success {
    background-color: #4cd137;
    color: #fff;
}

/* Main dashboard area */
main {
    padding: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
}

/* Device add box - full width control */
.device-add-box {
    background-color: #ffffff;
    border-radius: 12px;
    padding: 2rem;
    width: 50%;           /* new: wider relative to parent */
    max-width: 700px;     /* max width for large screens */
    margin: 2rem auto;    /* center horizontally */
    box-shadow: 0 6px 12px rgba(0,0,0,0.1);
    text-align: left;
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Form inside box */
.device-add-box form {
    display: flex;
    flex-direction: column;
    width: 100%;          /* ensure form stretches full box width */
}

/* Labels */
.device-add-box label {
    margin-top: 1rem;
    margin-bottom: 0.3rem;
    font-weight: 600;
    color: #333333;
}

/* Inputs and textarea */
.device-add-box input,
.device-add-box select,
.device-add-box textarea {
    padding: 0.6rem 0.8rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 1rem;
    width: 70%;        /* inputs now fill box width */
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* Save button */
.device-add-box button[type="submit"] {
    margin-top: 1.5rem;
    padding: 0.75rem;
    background-color: #007BFF;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    width: 50%;          /* button stretches full width */
    transition: background-color 0.2s, transform 0.2s;
}

.device-add-box button[type="submit"]:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

.device-add-box h2 {
    text-align: center;
    margin-bottom: 1.5rem; /* optional spacing below the heading */
    color: #224e94;
    font-weight: 700;
}

/* Alerts */
.device-add-box .alert {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-weight: 500;
}

.device-add-box .alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.device-add-box .alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}


/* Mobile responsiveness */
@media (max-width: 768px) {
    .nav-links {
        position: absolute;
        top: 60px;
        left: 0;
        right: 0;
        background-color: #1b2a49;
        flex-direction: column;
        display: none;
        padding: 1rem 2rem;
        border-radius: 0 0 10px 10px;
        gap: 1rem;
        z-index: 100;
    }

    .nav-links.active {
        display: flex;
    }

    /* User info below menu on mobile */
    .user-info {
        display: block;
        margin-top: 0.5rem;
        text-align: center;
        max-width: 100%;
    }

    .header-left {
        gap: 0.5rem;
    }
}
