@import url('https://fonts.googleapis.com/css2?family=Quicksand:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Quicksand', sans-serif;
}

body {
    background: #000;
    overflow: hidden;
}

/* Background Tiles */
section {
    position: fixed;
    inset: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    justify-content: center;
    align-items: center;
}

section::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(#000, #4a6616, #000);
    animation: animate 6s linear infinite;
    z-index: 0;
}

@keyframes animate {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

section span {
    width: calc(6.25vw - 2px);
    height: calc(6.25vw - 2px);
    background: #181818;
    z-index: 1;
}

/* Register/Login Box */
.reg-box {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vw;
    max-width: 800px;
    min-height: 50vh;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.90), rgba(74, 102, 22, 0.85));
    border-radius: 15px;
    padding: 18px;
    border: 3px solid #1e4803;
    box-shadow: 0 4px 30px #1e4803cc;
    backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
}

.reg-header {
    text-align: center;
}

.reg-header img {
    width: 90px;
    margin-bottom: 4px;
}

.reg-header h1 {
    font-size: 1.6em;
    font-weight: 700;
    color: #1e4803;
    margin: 15px 0 5px;
}

.reg-header h2 {
    font-size: 1.3em;
    font-weight: 600;
    color: #1e4803;
    margin-bottom: 20px;
}

.reg-scroll {
    flex: 1;
    overflow-y: auto;
    padding-right: 5px;
}

.reg-scroll::-webkit-scrollbar {
    width: 6px;
}

.reg-scroll::-webkit-scrollbar-thumb {
    background: #1e4803;
    border-radius: 10px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 10px;
}

.field {
    display: flex;
    flex-direction: column;
}

.field label {
    font-size: 0.8em;
    font-weight: 600;
    color: #1e4803;
    margin-bottom: 2px;
}

input, select {
    width: 100%;
    height: 36px;
    background: #f0f3ed;
    border: 1px solid #1e4803;
    padding: 6px 8px;
    font-size: 0.9em;
    color: #1e4803;
    font-weight: 600;
    border-radius: 5px;
}

input[type="submit"] {
    width: 40%;
    background: #1e4803;
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    transition: 0.2s;
    border: none;
}

input[type="submit"]:hover {
    opacity: 0.85;
}

.inputBox {
    margin-top: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.login-link {
    margin-top: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.login-link .text {
    color: #fff;
    font-size: 1.1em;
    font-weight: 600;
}

.login-link .login-btn {
    color: #c1e6c9;
    font-weight: bold;
    font-size: 1.1em;
    text-decoration: none;
}

.login-link .login-btn:hover {
    text-decoration: underline;
}

.error {
    color: #721c24;
    text-align: center;
    margin-top: 10px;
}

/* Dashboard Styles */
.dashboard {
    display: flex;
    min-height: 100vh;
    background: #f0f3ed;
}

.sidebar {
    width: 250px;
    background: #1e4803;
    color: white;
    padding: 20px;
    position: fixed;
    height: 100%;
}

.sidebar .logo {
    width: 120px;
    margin-bottom: 20px;
}

.sidebar ul {
    list-style: none;
}

.sidebar ul li {
    margin: 15px 0;
}

.sidebar ul li a {
    color: white;
    text-decoration: none;
    font-size: 1.1em;
    padding: 10px;
    display: block;
    border-radius: 5px;
}

.sidebar ul li a.active, .sidebar ul li a:hover {
    background: #4a6616;
}

.content {
    margin-left: 250px;
    padding: 20px;
    width: calc(100% - 250px);
}

.table-container {
    width: 100%;
    overflow-x: auto;
    margin: 20px 0;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
}

.table-container h2 {
    text-align: center;
    color: #1e4803;
    margin-bottom: 20px;
    font-size: 1.6em;
}

.data-logger-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.data-logger-table th {
    background: #1e4803;
    color: white;
    padding: 14px 12px;
    text-align: left;
    font-weight: 600;
}

.data-logger-table td {
    padding: 12px;
    border-bottom: 1px solid #ddd;
}

.data-logger-table tr:hover {
    background-color: #f0f3ed;
}

.data-logger-table a {
    color: #1e4803;
    text-decoration: none;
    font-weight: 600;
}

.data-logger-table a:hover {
    text-decoration: underline;
}

.status {
    font-weight: bold;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9em;
}

.status.online {
    background: #d4edda;
    color: #155724;
}

.status.offline {
    background: #f8d7da;
    color: #721c24;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #ccc;
}

.empty-state a {
    color: #1e4803;
    font-weight: bold;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    body {
        overflow: auto;
    }

    section span {
        width: calc(20vw - 2px);
        height: calc(20vw - 2px);
    }

    .reg-box {
        width: 94vw;
        max-width: none;
        min-height: auto;
        max-height: 90vh;
        padding: 20px 16px;
        border-radius: 18px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    input, select {
        height: 48px;
        font-size: 1em;
        padding: 10px 14px;
        border-radius: 8px;
    }

    input[type="submit"] {
        width: 100%;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
    }

    .content {
        margin-left: 0;
        width: 100%;
    }

    .data-logger-table thead {
        display: none;
    }

    .data-logger-table tr {
        display: block;
        margin-bottom: 20px;
        border: 1px solid #ccc;
        border-radius: 10px;
        padding: 10px;
        background: #f9f9f9;
    }

    .data-logger-table td {
        display: block;
        text-align: right;
        padding: 10px;
        position: relative;
        border: none;
    }

    .data-logger-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 10px;
        font-weight: bold;
        color: #1e4803;
    }
}