/* 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;
    color: #ffffff;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

/* Left: hamburger + LockSync text */
.header-left {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.header-left h1 {
    font-size: 1.8rem;
    color: #ffffff;
}

.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;
    text-align: right;
    color: #ffffff;
    max-width: 50%;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Navigation links - hidden by default */
.nav-links {
    list-style: none;
    display: none;
    flex-direction: column;
    gap: 1rem;
    position: absolute;
    top: 60px;
    left: 1rem;
    background-color: #224e94;
    padding: 1rem 2rem;
    border-radius: 6px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    border: 2px solid orange;
    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;
}

.nav-links li a:hover {
    background-color: orange;
    color: #224e94;
}

/* 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: 90%;
    max-width: 1000px;      /* max width for the table */
    margin: 2rem auto;
    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;
}

.device-add-box h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #224e94;
    font-weight: 700;
}

/* Form inside box */
.device-add-box form {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.device-add-box label {
    margin-top: 1rem;
    margin-bottom: 0.3rem;
    font-weight: 600;
    color: #333333;
}

.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%;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.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: 100%;
    transition: background-color 0.2s, transform 0.2s;
}

.device-add-box button[type="submit"]:hover {
    background-color: #0056b3;
    transform: translateY(-2px);
}

/* Alerts inside box */
.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 {
        display: block;
        margin-top: 0.5rem;
        text-align: center;
        max-width: 100%;
    }

    .header-left {
        gap: 0.5rem;
    }
}

/* ----- Table Styling ----- */
.table-wrapper {
    overflow-x: auto; /* scroll if table wider than container */
}

.device-add-box table {
    width: 100%;
    max-width: 1000px;       /* expand up to 1000px */
    margin: 1rem auto;
    border-collapse: collapse;
    table-layout: auto;      /* automatic column widths */
    font-family: Arial, sans-serif;
}

.device-add-box th,
.device-add-box td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #ddd;
    text-align: left;
    white-space: nowrap;     /* prevent wrapping */
}

.device-add-box th {
    background: #2E86C1;     /* metallic blue header */
    color: #fff;
    font-weight: bold;
}

.device-add-box tr:hover {
    background-color: #f0f8ff;
}

.device-add-box button.edit-btn {
    background-color: #3498DB;
    color: #fff;
    padding: 0.4rem 0.8rem;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.2s;
}

.device-add-box button.edit-btn:hover {
    background-color: #2874A6;
}

/* Enrollment used status */
.used {
    color: #C0392B;
    font-weight: bold;
}

.unused {
    color: #27AE60;
    font-weight: bold;
}

/* ----- Modal Styling ----- */
.modal {
    display: none;
    position: fixed;
    z-index: 999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: #ffffff;
    padding: 2rem;
    border-radius: 12px;
    width: 500px;
    max-width: 90%;
    position: relative;
    box-shadow: 0 6px 12px rgba(0,0,0,0.25);
    animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px);}
    to { opacity: 1; transform: translateY(0);}
}

.modal-content h3 {
    margin-top: 0;
    text-align: center;
    color: #2E86C1;
}

.modal-content label {
    display: block;
    margin-top: 1rem;
    font-weight: bold;
    color: #333;
}

.modal-content input[type="text"],
.modal-content select {
    width: 100%;
    padding: 0.5rem;
    margin-top: 0.3rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    box-sizing: border-box;
}

.modal-content input[type="checkbox"] {
    margin-right: 0.5rem;
}

.modal-content button {
    margin-top: 1.5rem;
    background-color: #3498DB;
    color: #fff;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    width: 100%;
    font-weight: bold;
    transition: background 0.2s;
}

.modal-content button:hover {
    background-color: #2874A6;
}

.modal-content .close {
    position: absolute;
    top: 0.5rem;
    right: 0.8rem;
    font-size: 1.5rem;
    font-weight: bold;
    color: #333;
    cursor: pointer;
}
