/* src/public/styles.css */
@import url('https://fonts.googleapis.com/css2?family=Roboto+Flex:wght@300;400;500;700&display=swap');

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

body {
    font-family: 'Roboto Flex', sans-serif;
    background-color: #f5f6f5;
    color: #333;
    line-height: 1.6;
    padding: 10px;
    min-height: 100vh;
}

header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 0.5rem 0;
    flex-wrap: wrap;
}

header .logo {
    width: 40px;
    height: 40px;
    background: url('/logo-black.png') no-repeat center;
    background-size: contain;
    margin-right: 0.5rem;
}

header .title {
    display: flex;
    flex-direction: column;
    align-items: center;
}

header .title .main-title {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1.2;
    text-transform: uppercase;
    font-style: italic;
    letter-spacing: 2px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.1);
    background: linear-gradient(90deg, #000000, #00cc99);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

header .title .main-title:hover {
    color: #0066cc;
    transition: color 0.3s ease;
}

h1, h2, h3 {
    font-weight: 500;
    color: #1a1a1a;
    margin-bottom: 0.8rem;
}

h1 {
    font-size: 1.5rem;
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 0.4rem;
}

h2 {
    font-size: 1.2rem;
}

nav {
    background-color: #fff;
    padding: 0.8rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

nav a {
    color: #000;
    text-decoration: none;
    font-weight: 200;
    transition: background-color 0.2s ease;
    margin: 0.5rem 1rem;
    padding: 0.5rem 1rem;
    border-radius: 4px;
}

nav a:hover {
    background-color: #f0f0f0;
}

.user-menu {
    position: relative;
    margin-left: auto;
}

.user-icon {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    color: #333;
}

.user-icon:hover {
    background-color: #f0f0f0;
}

.dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: #fff;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    min-width: 120px;
    z-index: 1000;
}

.user-menu:hover .dropdown {
    display: block;
}

.dropdown a {
    display: block;
    padding: 0.5rem 1rem;
    color: #000;
    text-decoration: none;
    font-weight: 400;
    border-radius: 4px;
}

.dropdown a:hover {
    background-color: #f0f0f0;
}

form {
    margin: 1rem 0;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    width: 100%;
}

label {
    display: flex;
    flex-direction: column;
    font-weight: 400;
    color: #555;
}

input[type="text"],
input[type="email"],
input[type="password"],
select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Roboto Flex', sans-serif;
    font-size: 0.95rem;
    width: 100%;
    transition: border-color 0.2s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
select:focus {
    border-color: #0066cc;
    outline: none;
}

input[type="submit"],
button {
    padding: 0.5rem 1rem;
    background-color: #000;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Roboto Flex', sans-serif;
    font-weight: 500;
    transition: background-color 0.2s ease;
    width: auto;
}

input[type="submit"]:hover,
button:hover {
    background-color: #003366;
}

input[type="submit"]:disabled,
button:disabled {
    background-color: #999;
    cursor: not-allowed;
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
    border-radius: 8px;
    overflow-x: auto;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
    display: block;
}

th, td {
    padding: 0.8rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.9rem;
}

th {
    background-color: #f8f9f8;
    font-weight: 500;
    color: #1a1a1a;
    white-space: nowrap;
}

td a {
    color: #0066cc;
    text-decoration: none;
}

td a:hover {
    text-decoration: underline;
}

td.actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

td.actions a,
td.actions form {
    display: inline-block;
}

td.actions input[type="submit"] {
    background-color: #ff4d4f;
}

td.actions input[type="submit"]:hover {
    background-color: #d9363e;
}

ul {
    list-style: none;
    margin: 1rem 0;
}

li {
    padding: 0.4rem 0;
    border-bottom: 1px solid #e0e0e0;
}

li:last-child {
    border-bottom: none;
}

.status-circle {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 5px;
}

.online {
    background-color: green;
}

.offline {
    background-color: red;
}

#map {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    width: 100%;
    min-height: 200px;
}

#flash-message {
    padding: 0.6rem;
    background-color: #ffebee;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.loudspeaker-controls {
    margin: 1rem 0;
}

.loudspeaker-controls audio {
    display: block;
    margin-bottom: 1rem;
    width: 100%;
    max-width: 300px;
}

.loudspeaker-controls .button-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.loudspeaker-controls .button-group form {
    display: inline-block;
    margin: 0;
}

.pagination {
    margin: 1rem 0;
    text-align: center;
}

.pagination-controls {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.pagination-link {
    display: inline-block;
    padding: 0.5rem 0.8rem;
    text-decoration: none;
    color: #0066cc;
    border: 1px solid #ddd;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.pagination-link:hover {
    background-color: #f0f0f0;
    border-color: #0066cc;
}

.pagination-link.active {
    background-color: #0066cc;
    color: white;
    border-color: #0066cc;
}

.pagination p {
    font-size: 0.9rem;
    color: #555;
}

.tag-badge {
    background-color: #e6f0fa;
    color: #1a3c6d;
    padding: 4px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.4;
    transition: background-color 0.2s ease, transform 0.1s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    margin-right: 5px;
    display: inline-block;
}

.tag-badge:hover {
    background-color: #d1e4f9;
    transform: translateY(-1px);
}

.tag-badge span.tag-text {
    margin-right: 4px;
}

.remove-tag {
    display: inline-block;
    background-color: #ff4d4f;
    color: white;
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 10px;
    line-height: 1.4;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.1s ease;
    border: none;
    vertical-align: middle;
}

.remove-tag:hover {
    background-color: #d9363e;
    transform: scale(1.1);
}

.remove-tag:active {
    transform: scale(0.95);
}

form:has(.remove-tag) {
    display: inline;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    header .logo {
        width: 35px;
        height: 35px;
    }

    header .title .main-title {
        font-size: 1.5rem;
    }

    h1 {
        font-size: 1.3rem;
    }

    h2 {
        font-size: 1.1rem;
    }

    form {
        gap: 0.6rem;
    }

    table {
        font-size: 0.85rem;
    }

    th, td {
        padding: 0.6rem;
        min-width: 100px;
    }

    td.actions {
        flex-direction: column;
        gap: 0.3rem;
    }

    form input[type="submit"],
    form button {
        width: 100%;
        margin: 0.3rem 0;
    }

    nav {
        padding: 0.6rem;
        flex-direction: column;
        align-items: flex-start;
    }

    nav a {
        margin: 0.4rem 0;
        padding: 0.4rem 0.8rem;
    }

    .user-menu {
        margin-left: 0;
        margin-top: 0.5rem;
    }

    .dropdown {
        right: auto;
        left: 0;
    }

    .loudspeaker-controls .button-group {
        flex-direction: column;
    }

    .loudspeaker-controls .button-group button,
    .loudspeaker-controls .button-group input[type="submit"] {
        width: 100%;
    }

    .tag-badge {
        font-size: 0.8rem;
        padding: 3px 5px;
        margin-right: 4px;
        margin-bottom: 4px;
        border-radius: 4px;
    }

    .remove-tag {
        font-size: 9px;
        padding: 1px 3px;
    }
}

@media (min-width: 769px) {
    body {
        padding: 20px;
    }

    header .logo {
        width: 50px;
        height: 50px;
    }

    header .title .main-title {
        font-size: 2rem;
        letter-spacing: 3px;
    }

    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.4rem;
    }

    nav {
        padding: 1rem;
    }

    nav a {
        display: inline-block;
        margin-right: 1rem;
    }

    form {
        max-width: 400px;
    }

    table {
        display: table;
    }

    th, td {
        padding: 1rem;
        font-size: 1rem;
    }
}

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    margin-right: 6px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.status-badge.firing {
    background-color: #d32f2f;
}

.status-badge.silenced {
    background-color: #757575;
}

.icon-button {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0;
    margin-left: 4px;
    vertical-align: middle;
    transition: transform 0.1s ease;
}

.icon-button:hover {
    transform: scale(1.1);
}

.create-alert-container {
    background: #fff;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    max-width: 600px;
}

.alert-form .form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.75rem;
}

.inline-form {
    display: inline;
}

.secondary-btn {
    background: #eee;
    color: #333;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 0.5rem;
}

.danger-btn {
    background: #d32f2f;
    color: #fff;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
}

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

.note-form textarea {
    width: 100%;
    resize: vertical;
}

.back-link {
    display: inline-block;
    margin-top: 1rem;
    color: #0066cc;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

table {
    margin-bottom: 1.5rem;
}

th, td {
    padding: 0.6rem 0.8rem;
}

.section-card {
    background: #fff;
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.section-card h2 {
    margin-top: 0;
    margin-bottom: 0.75rem;
    font-size: 1.2rem;
}

.status-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-header h1 {
    margin: 0;
    font-size: 1.5rem;
}

.status-text {
    margin: 0;
    color: #555;
    font-size: 1rem;
}

.info-text {
    margin: 0.25rem 0 0;
    color: #666;
    font-size: 0.9rem;
}

.map-container {
    width: 100%;
    height: 300px;
    border-radius: 4px;
    overflow: hidden;
}

.metrics-table,
.relay-table,
.notes-table,
.event-table {
    width: 100%;
    border-collapse: collapse;
}

.metrics-table th, .metrics-table td,
.relay-table th,  .relay-table td,
.notes-table th, .notes-table td,
.event-table th, .event-table td {
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid #e0e0e0;
    font-size: 0.9rem;
}

.pagination {
    margin: 0.5rem 0;
    text-align: center;
    font-size: 0.8rem;
    color: #555;
}

.pagination-controls {
    display: inline-flex;
    gap: 0.25rem;
}

.pagination-link {
    padding: 0.2rem 0.4rem;
    background: none;
    border: none;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.pagination-link:hover {
    color: #0066cc;
    text-decoration: underline;
}

.pagination-link.active {
    font-weight: 600;
    text-decoration: underline;
}

.pagination p {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #777;
}

.leaflet-control-attribution {
    display: none !important;
}

body.login-page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 0;
}

.login-wrapper {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.login-container {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    max-width: 320px;
    width: 100%;
    text-align: center;
}

.login-container h1 {
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

.login-container form {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.login-container label {
    text-align: left;
}

.login-container input[type="submit"] {
    margin-top: 1rem;
}

.google-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1rem;
    background-color: #4285F4;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    font-family: 'Roboto Flex', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    transition: background-color 0.2s ease;
    margin-top: 1rem;
    width: 100%;
}

.google-btn:hover {
    background-color: #357ae8;
}

.google-btn img {
    width: 18px;
    height: 18px;
    margin-right: 8px;
}

.login-container input[type="submit"],
.login-container .google-btn {
    background-color: #000000 !important;
    color: #fff !important;
    font-family: 'Roboto Flex', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    padding: 0.75rem 1rem !important;
    border-radius: 4px !important;
    border: none !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.login-container input[type="submit"]:hover,
.login-container .google-btn:hover {
    background-color: #357ae8 !important;
}

#rebootConfirm {
    display: none;
}

#rebootConfirm.show {
    display: block;
}

.expanded-stream {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.9);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    z-index: 9999;
}

.expanded-stream video {
    max-width: 90%;
    max-height: 70%;
    border-radius: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.ptz-controls {
    margin-top: 12px;
    display: flex; gap: 8px; flex-wrap: wrap;
}

.ptz-controls button {
    background-color: #0066cc;
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background-color 0.2s ease;
}

.ptz-controls button:hover {
    background-color: #0055a3;
}
