/* ============================================ */
/* STILI GLOBALI - Tutte le pagine             */
/* ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #2e1404 0%, #301706 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 30px 40px 40px;
}

.header {
    text-align: center;
    margin-bottom: 30px;
}

.header h1 {
    font-size: 2em;
    color: #333;
    margin-bottom: 8px;
    font-weight: 600;
}
.login-card h1 {
    font-family: "Bodoni MT", "Bodoni", "Didot", "Times New Roman", serif;
}
h1 {
    font-family: "Bodoni MT", "Bodoni", "Didot", "Times New Roman", serif;
}
h1::before {
    content: "";
    display: block;
    height: 8px;
    margin: 8px auto;
    background-image: linear-gradient(to bottom, #333 0px, #333 4px, /* linea SPESSA (4px) sopra */ transparent 4px, transparent 6px, #333 6px, #333 8px /* linea SOTTILE (2px) sotto */);
}
h1::after {
    content: "";
    display: block;
    height: 8px;
    margin: 8px auto;
    background-image: linear-gradient(to bottom, #333 0px, #333 2px, /* linea SOTTILE (2px) sopra */ transparent 2px, transparent 4px, #333 4px, #333 8px /* linea SPESSA (4px) sotto */);
}

.header p {
    color: #666;
    font-size: 1em;
}

.controls {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
}

.btn, button {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 1em;
    text-decoration: none;
    color: #fff;
    background: #667eea;
    transition: all 0.2s ease-out;
    border: none;
    cursor: pointer;
    font-weight: 500;
}

.btn-primary, .btn {
    background: #667eea;
}

.btn-primary:hover, .btn:hover {
    background: #5a67d8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: #764ba2;
}

.btn-secondary:hover {
    background: #5f3b8a;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(118, 75, 162, 0.3);
}

.btn-danger {
    background: #ef4444;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

a.btn, a.btn-primary, a.btn-secondary, a.btn-danger {
    text-decoration: none;
    display: inline-block;
}


/* ============================================ */
/* LOGS VIEWER / ADMIN - Tabelle e filtri       */
/* ============================================ */

.table-wrapper {
    overflow-x: auto;
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}

thead th {
    background: #f8f9fa;
    color: #333;
    font-weight: 600;
    padding: 12px 10px;
    border-bottom: 2px solid #dee2e6;
}

tbody td {
    padding: 10px;
    border-bottom: 1px solid #dee2e6;
    color: #333;
}

input[type="text"],
input[type="password"],
input[type="email"],
select {
    width: 100%;
    padding: 10px 12px;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    font-size: 1em;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: white;
}

tr.filter-row input {
    width: 98%;
    padding: 4px 6px;
    border-radius: 4px;
    border: 1px solid #cbd5e1;
}

.status-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.95em;
    font-weight: 500;
}

.status-active {
    background: #c6f6d5;
    color: #22543d;
}

.status-inactive {
    background: #fed7d7;
    color: #822727;
}

/* ============================================ */
/* MESSAGGI E COMUNI - Notifiche e utility      */
/* ============================================ */

.info-banner, .error-banner, .warning-banner, .success-banner {
    padding: 10px 18px;
    border-radius: 6px;
    margin-bottom: 18px;
    font-size: 1.05em;
}

.info-banner {
    background: #caeccc;
    color: #292929;
}

.error-banner, .error {
    background: #fed7d7;
    color: #822727;
}

.warning-banner {
    background: #fff3cd;
    color: #856404;
}

.success-banner {
    background: #d4edda;
    color: #155724;
}

.empty {
    text-align: center;
    color: #a0aec0;
    margin: 30px 0 10px;
}

.empty-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.footer {
    text-align: center;
    color: #a0aec0;
    font-size: 0.98em;
    margin-top: 40px;
}

/* ============================================ */
/* INDEX.PHP - LOGIN PAGE                       */
/* ============================================ */

body.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: white;
    margin: 0 auto;
    max-width: 400px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.13);
    padding: 40px 30px;
}

.logo {
    text-align: center;
    margin-bottom: 18px;
}

.logo-circle {
    background: #667eea;
    color: #fff;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2em;
    margin: 0 auto 10px;
}

h2 {
    text-align: center;
    color: #333;
    margin-bottom: 8px;
    font-size: 1.5em;
    font-weight: 600;
}

.subtitle {
    text-align: center;
    color: #6b7280;
    margin-bottom: 18px;
}

.form-group {
    margin-bottom: 18px;
}

label {
    display: block;
    margin-bottom: 6px;
    color: #333;
    font-weight: 500;
}

button[type="submit"] {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 1.1em;
    font-weight: 500;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s ease-out;
}

button[type="submit"]:hover {
    background: #5a67d8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

button[type="submit"]:active {
    transform: translateY(0);
}

.error {
    background: #fee;
    color: #c33;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 12px;
    text-align: center;
    border-left: 4px solid #c33;
}

.footer-note {
    text-align: center;
    color: #a0aec0;
    font-size: 0.95em;
    margin-top: 18px;
}

/* ============================================ */
/* DASHBOARD.PHP - Dashboard principale         */
/* ============================================ */

.dashboard-container {
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card-large {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 30px;
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease-out;
    border-left: 5px solid #667eea;
    position: relative;
}

.card-large:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
}

.card-large .card-icon {
    font-size: 3em;
    min-width: 80px;
    text-align: center;
}

.card-large .card-content {
    flex: 1;
}

.card-large h2 {
    font-size: 1.3em;
    color: #333;
    margin-bottom: 8px;
    text-align: left;
}

.card-large p {
    color: #666;
    font-size: 0.95em;
    text-align: left;
}


.btn-video {
    border-left-color: #667eea;
}

.btn-vpn {
    border-left-color: #764ba2;
}

.btn-admin {
    border-left-color: #10b981;
}

.btn-cleaner {
    border-left-color: #f59e0b;
}

/* Manuali ed Istruzioni card */
.btn-manuals {
    border-left-color: #f97316;
}

/* Software card */
.btn-software {
    border-left-color: #0ea5e9;
}

/* Immagine coordinata card */
.btn-immagine {
    border-left-color: #e11d48;
}

/* Stato server card */
.btn-serverstatus {
    border-left-color: #16a34a;
}

/* UPS card */
.btn-ups {
    border-left-color: #f59e0b;
}



.info-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 20px;
    text-align: center;
}

.info-card h3 {
    color: #667eea;
    font-size: 1em;
    margin-bottom: 8px;
}

.info-card p {
    color: #333;
    font-size: 1.2em;
    font-weight: 600;
}

.btn-admin {
    border-left: 5px solid #10b981;
}

.btn-cleaner {
    border-left: 5px solid #f59e0b;
}

/* ============================================ */
/* ADMIN.PHP - Pannello amministrazione         */
/* ============================================ */

.navbar {
    background: white;
    padding: 20px 30px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px;
    margin-bottom: 30px;
}

.navbar-brand {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
}

.page-header {
    margin-bottom: 30px;
}



.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    padding: 30px;
    margin-bottom: 30px;
}

.card h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 22px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-admin {
    background: #dbeafe !important;
    color: #1e40af !important;
}

.badge-manager {
    background: #fef3c7 !important;
    color: #92400e !important;
}

.badge-user {
    background: #e5e7eb !important;
    color: #374151 !important;
}


.message {
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.message-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid #10b981;
}

.message-error {
    background: #fee;
    color: #c33;
    border-left: 4px solid #ef4444;
}

/* ============================================ */
/* LOG_CLEANER.PHP - Gestione log               */
/* ============================================ */

.preview-box {
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.preview-box p {
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    color: #555;
    margin: 5px 0;
    word-break: break-all;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    max-width: 500px;
    text-align: center;
}

/* ============================================ */
/* VIDEO.PHP - Videosorveglianza                */
/* ============================================ */

:root {
    --bg-dark: #0f172a;
    --accent: #38bdf8;
    --text-primary: #e5e7eb;
    --text-secondary: #9ca3af;
}

body.video-page {
    background: #000;
    padding: 0;
}

body.video-page .header {
    padding: 16px 20px;
    background: linear-gradient(to right, rgba(15, 23, 42, 0.95), rgba(15, 23, 42, 0.85));
    backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 10;
    text-align: left;
    margin: 0;
}

body.video-page .header h1 {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.03em;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 30px;
}

.header-info .user-badge {
    flex: 0 0 auto;
}

.header-info form {
    margin-left: auto;
}

.user-badge {
    padding: 12px 20px;
    /* border-radius: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);*/
    border: none;
    font-size: 2em;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #000000;
    font-weight: 500;
    /* box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3); */
}

.back-btn {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: radial-gradient(circle at top left, rgba(148, 163, 184, 0.3), rgba(15, 23, 42, 0.95));
    color: var(--text-primary);
    font-size: 13px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.18s;
}

.back-btn:hover {
    border-color: var(--accent);
    color: #e0f2fe;
    transform: translateY(-1px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.8);
}

.back-btn::before {
    content: "⟵";
    font-size: 12px;
}

.content-container {
    padding: 0;
    background: #000;
    min-height: calc(100vh - 60px);
}

iframe {
    width: 100%;
    height: calc(100vh - 60px);
    border: none;
    background: #000;
}

@media (max-width: 640px) {
    body.video-page .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    body.video-page .header h1 {
        font-size: 18px;
    }
    
    .header-info {
        width: 100%;
        justify-content: space-between;
    }
    
    .user-badge {
        max-width: 60%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* Background bianco solo per la pagina video */
body.video-page {
    background: #ffffff !important;
}

/* ============================================ */
/* DASHBOARD CARDS - Pulsanti navigazione       */
/* ============================================ */

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin-top: 40px;
    padding: 20px 0;
}

.dashboard-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    padding: 0;
    background: white;
    border-radius: 16px;
    text-decoration: none;
    color: inherit;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    overflow: hidden;
    min-height: 280px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.dashboard-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--card-color-1, #667eea), var(--card-color-2, #764ba2));
    transition: height 0.4s ease;
}

.dashboard-card:hover {
    transform: translateY(-12px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border-color: rgba(0, 0, 0, 0.1);
}

.dashboard-card:hover::before {
    height: 6px;
}

.dashboard-card:active {
    transform: translateY(-4px);
}

.card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 25px;
    height: 100%;
    text-align: center;
}

.card-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--card-color-1, #667eea)20, var(--card-color-2, #764ba2)20);
    margin-bottom: 20px;
    transition: all 0.4s ease;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.dashboard-card:hover .card-icon-wrapper {
    transform: scale(1.15) rotateZ(10deg);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.card-icon {
    font-size: 2.5em;
    display: block;
    transition: transform 0.3s ease;
}

.dashboard-card:hover .card-icon {
    transform: scale(1.2);
}

.card-title {
    font-size: 1.4em;
    font-weight: 700;
    color: #2c3e50;
    margin: 15px 0 10px 0;
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
}

.dashboard-card:hover .card-title {
    color: var(--card-color-1, #667eea);
}

.card-description {
    font-size: 0.95em;
    color: #7f8c8d;
    line-height: 1.5;
    margin: 0 0 15px 0;
    transition: color 0.3s ease;
}

.dashboard-card:hover .card-description {
    color: #5a6c7d;
}

.card-arrow {
    font-size: 1.5em;
    color: var(--card-color-1, #667eea);
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: auto;
    padding-top: 10px;
}

.dashboard-card:hover .card-arrow {
    opacity: 1;
    transform: translateX(0);
}

/* ============================================ */
/* COLORI SPECIFICI PER OGNI CARD               */
/* ============================================ */

.card-temperature {
    --card-color-1: #FF6B6B;
    --card-color-2: #FF8E72;
}

.card-temperature .card-icon-wrapper {
    background: linear-gradient(135deg, #FF6B6B20, #FF8E7220);
}

.card-temperature:hover .card-title {
    color: #FF6B6B;
}

.card-temperature .card-arrow {
    color: #FF6B6B;
}

.card-lights {
    --card-color-1: #FFD93D;
    --card-color-2: #FFC700;
}

.card-lights .card-icon-wrapper {
    background: linear-gradient(135deg, #FFD93D20, #FFC70020);
}

.card-lights:hover .card-title {
    color: #FFD93D;
}

.card-lights .card-arrow {
    color: #FFD93D;
}

.card-vacuum {
    --card-color-1: #6BCB77;
    --card-color-2: #4D96AA;
}

.card-vacuum .card-icon-wrapper {
    background: linear-gradient(135deg, #6BCB7720, #4D96AA20);
}

.card-vacuum:hover .card-title {
    color: #6BCB77;
}

.card-vacuum .card-arrow {
    color: #6BCB77;
}

/* ============================================ */
/* RESPONSIVE DESIGN                            */
/* ============================================ */

@media (max-width: 768px) {
    .dashboard-cards {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .dashboard-card {
        min-height: 240px;
    }
    
    .card-content {
        padding: 30px 20px;
    }
    
    .card-icon-wrapper {
        width: 70px;
        height: 70px;
    }
    
    .card-icon {
        font-size: 2em;
    }
    
    .card-title {
        font-size: 1.2em;
    }
    
    .card-description {
        font-size: 0.9em;
    }
}

