/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #e8f4f8 0%, #f3e2cc 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ===== NAV ===== */
nav {
    width: 100%;
    background: rgb(60, 63, 63);
    border-radius: 0 0 20px 20px;
    padding: 0 20px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

nav H1 {
    color: beige;
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 2px;
    flex-grow: 1;
    text-align: center;
}

/* ===== PROGRAM (account icon) ===== */
.program {
    align-items: center;
    position: absolute;
    background-color: rgb(60, 63, 63);
    right: 94.5%;
    width: 5%;
    height: 85%;
    top: 10%;
    border-radius: 15px;
}

.acc-img {
    position: absolute;
    top: 50%;
    left: -150%;
    scale: 10%;
    cursor: pointer;
}

/* ===== NEPŘIHLÁŠEN stránka ===== */
.notregistered {
    display: none;
}

.login-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 40px 20px;
    width: 100%;
}

.login-hero {
    text-align: center;
    margin-bottom: 40px;
}

.login-hero .hero-icon {
    font-size: 72px;
    margin-bottom: 16px;
    display: block;
}

.login-hero h2 {
    font-size: 2rem;
    color: rgb(60, 63, 63);
    margin-bottom: 10px;
}

.login-hero p {
    font-size: 1.05rem;
    color: #666;
    max-width: 320px;
    line-height: 1.6;
}

.loginbutton {
    background: rgb(60, 63, 63);
    color: beige;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 14px 40px;
    border-radius: 30px;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    position: static;
    transform: none;
    scale: 1;
}

.loginbutton:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.25);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 95%;
    max-width: 960px;
    margin-top: 30px;
    padding-bottom: 80px;
}

.devices-heading {
    color: rgb(60, 63, 63);
    font-size: 1.2rem;
    margin-bottom: 12px;
    align-self: flex-start;
    font-weight: 600;
}

/* ===== DEVICE GRID ===== */
.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    width: 100%;
    padding: 4px 0 20px;
}

.device-card {
    background: #ffffff;
    border-radius: 18px;
    padding: 22px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border-left: 5px solid #2196F3;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.device-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.13);
}

.device-card h3 {
    margin: 0 0 10px 0;
    color: #222;
    font-size: 1.1rem;
}

.device-info {
    font-size: 0.9rem;
    color: #666;
    line-height: 1.6;
}

.device-value {
    font-weight: bold;
    color: #2196F3;
    font-size: 1rem;
}

/* ===== DETAIL ===== */
#device-detail {
    width: 100%;
}

.btn-back {
    padding: 9px 18px;
    background: #607D8B;
    color: white;
    border: none;
    border-radius: 10px;
    margin-bottom: 16px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: background 0.2s;
}

.btn-back:hover { background: #455A64; }

#detail-title {
    color: rgb(60, 63, 63);
    font-size: 1.3rem;
    margin-bottom: 16px;
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 2px solid #e0e0e0;
    width: 100%;
}

.tab-btn {
    padding: 11px 24px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.95rem;
    color: #888;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    border-radius: 0;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.tab-btn:hover { color: #2196F3; }

.tab-btn.active {
    color: #2196F3;
    border-bottom: 3px solid #2196F3;
    font-weight: 600;
}

.tab-content { width: 100%; }

/* ===== GRAF ===== */
.range-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.range-btn {
    padding: 8px 22px;
    border: 2px solid #2196F3;
    background: none;
    color: #2196F3;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s;
}

.range-btn:hover { background: #e3f2fd; }
.range-btn.active { background: #2196F3; color: white; }

.chart-wrapper {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    width: 100%;
}

/* ===== HISTORIE ===== */
.filters {
    background: #f5f5f5;
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-size: 0.95rem;
}

.filters input[type="date"] {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #ccc;
    font-size: 0.95rem;
    margin-left: 8px;
}

.seznam-mereni { width: 100%; }

.history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.history-table th, .history-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    text-align: left;
}

.history-table th {
    color: #888;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #fafafa;
}

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

/* ===== PARAMETRY ===== */
.parametry-box {
    background: white;
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 480px;
}

.param-label {
    margin: 0 0 8px 0;
    color: #333;
    font-size: 0.95rem;
}

.param-select {
    width: 100%;
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid #ddd;
    font-size: 1rem;
    margin-bottom: 20px;
    background: #f9f9f9;
    color: #333;
}

.param-inputs {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 24px;
}

.param-row {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.param-row label {
    font-size: 0.88rem;
    color: #555;
    font-weight: 500;
}

.param-input {
    padding: 11px 14px;
    border-radius: 10px;
    border: 1px solid #ddd;
    font-size: 1rem;
    background: #f9f9f9;
    color: #333;
    transition: border-color 0.2s;
}

.param-input:focus {
    outline: none;
    border-color: #2196F3;
    background: white;
}

.param-save-btn {
    padding: 12px 32px;
    background: #2196F3;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.2s, transform 0.1s;
    box-shadow: 0 4px 12px rgba(33,150,243,0.3);
}

.param-save-btn:hover {
    background: #1976D2;
    transform: translateY(-1px);
}

.param-status {
    margin-top: 12px;
    font-size: 0.92rem;
    font-weight: 500;
}

/* ===== ACCOUNT BOX ===== */
.acc {
    background: rgb(60, 63, 63);
    width: 320px;
    max-width: 90vw;
    height: auto;
    max-height: 80vh;
    border-radius: 20px;
    color: beige;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    overflow-y: auto;
    padding: 30px 28px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
}

.acc h1 { font-size: 1.4rem; margin-bottom: 8px; }
.acc h2 { font-size: 1rem; color: #aaa; margin-bottom: 4px; }
.acc p { margin: 4px 0 16px; font-size: 1rem; }

.logout {
    color: aquamarine;
    font-size: 1rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ===== ADD BUTTON ===== */
.addButton-wrapper {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-top: 30px;
    margin-bottom: 20px;
}

.addButton {
    background: rgb(45, 46, 43);
    color: beige;
    border-radius: 25px;
    border: none;
    padding: 14px 36px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    margin-top: 24px;
}

.addButton:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.25);
}

/* ===== MOBILE ===== */
@media (max-width: 600px) {
    nav { border-radius: 0 0 16px 16px; height: 56px; }
    nav H1 { font-size: 1.3rem; }

    .main-content { width: 100%; padding: 0 12px 80px; margin-top: 20px; }

    .devices-grid { grid-template-columns: 1fr; gap: 14px; }

    .tab-btn { padding: 10px 14px; font-size: 0.88rem; }

    .range-btn { padding: 7px 16px; font-size: 0.85rem; }

    .chart-wrapper { padding: 12px; }

    .parametry-box { padding: 20px 16px; }

    .param-save-btn { width: 100%; }

    .acc { width: 90vw; padding: 24px 20px; }

    .addButton { padding: 13px 30px; font-size: 0.95rem; }

    .history-table th, .history-table td { padding: 10px 12px; font-size: 0.88rem; }

    .login-hero h2 { font-size: 1.6rem; }
    .login-hero .hero-icon { font-size: 56px; }
    .loginbutton { padding: 13px 36px; font-size: 1rem; }
}

@media (max-width: 400px) {
    .tabs { overflow-x: auto; }
    .tab-btn { padding: 10px 12px; font-size: 0.82rem; }
}

/* NASTAVENÍ ZÁLOŽKA */
.nastaveni-box {
    background: white;
    border-radius: 16px;
    padding: 28px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 480px;
}

.nastaveni-box h3 {
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 20px;
}

.nastaveni-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-delete {
    padding: 11px 24px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    transition: background 0.2s;
    align-self: flex-start;
}
.btn-delete:hover { background: #c62828; }

/* Čas od posledního měření */
.device-time {
    font-size: 0.78rem;
    color: #999;
    margin-top: 4px;
}