/* Global styles */
/*-------------- */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", Arial, sans-serif;
    background-color: #f1f5f9;
    color: #334155;
    line-height: 1.6;
}

/* Header */
/*------- */

header {
    background-image: url("/static/header-background.jpg");
    background-size: cover;
    background-position: center;
    color: white;
    padding: 28px 20px;
    text-align: center;
}

header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

header p {
    margin: 5px 0 0;
    color: #dbeafe;
    font-size: 0.95rem;
}

/* Navigation */
/*----------- */

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    background-color: white;
    padding: 12px 5%;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.nav-left,
.nav-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-right {
    gap: 18px;
}

nav a {
    display: inline-flex;
    align-items: center;
    color: #475569;
    text-decoration: none;
    font-weight: 600;
    padding: 9px 16px;
    border-radius: 8px;
    transition: background-color 0.2s, color 0.2s;
}

nav a:hover {
    background-color: #eff6ff;
    color: #2563eb;
}

.profile-link {
    gap: 9px;
}

/* Logout form and button */

nav form {
    display: inline-flex;
    margin: 0;
}

nav button {
    background-color: #fee2e2;
    color: #b91c1c;
    border: 1px solid transparent;
    padding: 9px 16px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

nav button:hover {
    background-color: #f37272;
    color: white;
}

/* Main content */
/*------------- */

main {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px;
}

h2 {
    color: #1e293b;
    margin-top: 0;
    margin-bottom: 10px;
    font-size: 1.7rem;
}

h3 {
    color: #334155;
}

/* Dashboard cards */
/*---------------- */

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 24px;
}

.card {
    background-color: white;
    padding: 24px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.card p {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2563eb;
    margin: 10px 0 0;
}

.device-card-heading .device-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    background-color: #eff6ff;
    border-radius: 10px;
}

.device-card-heading .device-icon img {
    width: 25px;
    height: 25px;
    object-fit: contain;
}

.device-card-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.device-card-heading .device-name {
    margin: 0;
}

/* Forms and inputs */
/*----------------- */

main form {
    margin-top: 20px;
}

label {
    display: inline-block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #334155;
}

input, select, textarea {
    width: 100%;
    max-width: 420px;
    padding: 11px 13px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background-color: white;
    color: #1e293b;
    font: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* General buttons */

button {
    background-color: #2563eb;
    color: white;
    border: none;
    padding: 11px 20px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

button:hover {
    background-color: #1d4ed8;
}

/* Tables */
/*------- */

table {
    width: 100%;
    margin-top: 20px;
    border-collapse: collapse;
    background-color: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
}

th, td {
    padding: 13px 16px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

th {
    background-color: #f9fbfd;
    color: #334155;
    font-weight: 700;
}

tr:last-child td {
    border-bottom: none;
}

/* Alerts and messages */
/*-------------------- */

.error {
    color: #b91c1c;
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    padding: 12px 15px;
    border-radius: 8px;
    max-width: 420px;
}

/* Device status cards */
/*--------------------*/

.device-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.device-card {
    background-color: white;
    padding: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
    transition: transform 0.2s, box-shadow 0.2s;
}

.device-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}

.device-name {
    font-size: 1.2rem;
    color: #1e293b;
    margin: 0 0 12px;
}

.device-details p {
    font-size: 0.9rem;
    font-weight: 400;
    color: #64748b;
    margin: 6px 0;
}

/* Device status labels */
/*--------------------- */

.device-status {
    display: inline-block;
    margin-top: 12px;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
}

.device-status.online {
    background-color: #dcfce7;
    color: #15803d;
}

.device-status.offline {
    background-color: #fee2e2;
    color: #b91c1c;
}

/* Last updated card */
/*------------------ */

.last-updated-card {
    background-color: rgba(255, 255, 255, 0.589);
    padding: 15px 20px;
    margin-top: 20px;
    margin-bottom: 25px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.last-updated-card h4 {
    margin: 0 0 8px;
    color: #64748b;
    font-size: 0.9rem;
    font-weight: 600;
}

.last-updated-card p {
    margin: 0;
    color: #1e293b;
    font-size: 1.1rem;
    font-weight: 600;
}


/* Profile page */
/*-------------*/

.profile-container {
    max-width: 950px;
    margin: 10px auto;
}

.page-heading {
    margin-bottom: 25px;
}

.page-heading p {
    color: #64748b;
    margin-top: 0;
}

.profile-card {
    background-color: white;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 25px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

.section-heading {
    display: flex;
    align-items: center;
    gap: 14px;
}

.section-heading h3 {
    margin: 0;
}

.section-heading p {
    color: #64748b;
    margin: 3px 0 0;
    font-size: 0.9rem;
}

.section-icon,
.device-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    background-color: #eff6ff;
    border-radius: 10px;
    font-size: 20px;
}

.profile-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 22px;
    margin-top: 25px;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-item span {
    color: #64748b;
    font-size: 0.85rem;
}

.detail-item strong {
    color: #1e293b;
    font-size: 0.95rem;
}

/* Devices section */

.devices-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.device-count {
    background-color: #eff6ff;
    color: #2563eb;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    white-space: nowrap;
}

.device-list {
    margin-top: 22px;
}

.device-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding: 18px 0;
    border-top: 1px solid #e2e8f0;
}

.device-info {
    display: flex;
    align-items: center;
    gap: 13px;
}

.device-info strong {
    color: #1e293b;
}

.device-info p {
    color: #64748b;
    margin: 3px 0 0;
    font-size: 0.85rem;
}

/* Device status labels in profile */

.device-list .device-status {
    display: inline-block;
    margin: 0;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
}

.device-list .device-status.online {
    background-color: #dcfce7;
    color: #15803d;
}

.device-list .device-status.offline {
    background-color: #fee2e2;
    color: #b91c1c;
}

.device-icon img {
    width: 25px;
    height: 25px;
    object-fit: contain;
}

/* Empty devices message */

.empty-devices {
    text-align: center;
    padding: 30px 10px;
    margin-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.empty-icon {
    font-size: 30px;
}

.empty-devices h4 {
    margin: 8px 0 4px;
    color: #334155;
}

.empty-devices p {
    color: #64748b;
    font-size: 0.9rem;
}

/* Add device form */

.add-device-section {
    border-top: 1px solid #e2e8f0;
    padding-top: 22px;
    margin-top: 20px;
}

.add-device-section h4 {
    margin: 0;
    color: #334155;
}

.add-device-section > p {
    color: #64748b;
    margin: 4px 0 0;
    font-size: 0.9rem;
}

.add-device-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    align-items: end;
    gap: 15px;
    margin-top: 20px;
}

.add-device-form .form-group {
    display: flex;
    flex-direction: column;
}

.add-device-form label {
    font-size: 0.9rem;
}

.add-device-form input,
.add-device-form select {
    max-width: none;
}

.add-device-button {
    white-space: nowrap;
    padding: 11px 16px;
}


/* Login and Register pages */
/*-------_------------------*/

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 25px 15px;
}

.auth-card {
    width: 100%;
    max-width: 480px;
    background-color: rgba(255, 255, 255, 0.589);
    padding: 35px;
    border: 1px solid rgba(226, 232, 240, 0.9);
    border-radius: 14px;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
}

.auth-heading {
    text-align: center;
    margin-bottom: 28px;
}

.auth-heading h2 {
    margin-bottom: 5px;
}

.auth-heading p {
    color: #64748b;
    margin: 0;
    font-size: 0.95rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-top: 0;
}

.auth-form-group {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.auth-form-group label {
    margin-bottom: 7px;
    font-size: 0.9rem;
}

.auth-form-group input {
    width: 100%;
    max-width: none;
    padding: 12px 14px;
}

.auth-button {
    width: 100%;
    margin-top: 5px;
    padding: 12px;
}

.auth-error {
    max-width: none;
    margin-bottom: 20px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid #e2e8f0;
}

.auth-footer p {
    margin: 0;
    color: #64748b;
    font-size: 0.9rem;
}

.auth-footer a {
    color: #2563eb;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.auth-footer a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}


/* Responsive layout */
/*------------------ */
@media (max-width: 600px) {
    header {
        padding: 22px 15px;
    }

    header h1 {
        font-size: 1.7rem;
    }

    nav {
        gap: 5px;
        padding: 12px 8px;
    }

    nav a,
    nav button {
        padding: 8px 11px;
        font-size: 0.9rem;
    }

    main {
        padding: 24px 16px;
    }

    .cards {
        grid-template-columns: 1fr;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .auth-container {
        padding: 15px 5px;
    }

    .auth-card {
        padding: 25px 20px;
    }
}
