/**
 * CSS styly pro evidenci odečtů měřidel
 */

/* Reset a základní nastavení */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background-color: #fff;
    min-height: 100vh;
}

/* Header */
header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #007bff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-size: 28px;
    color: #007bff;
    margin-bottom: 5px;
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.header-updated {
    font-size: 12px;
    font-weight: normal;
    color: #888;
    white-space: nowrap;
}

h2 {
    font-size: 22px;
    color: #333;
    margin-bottom: 15px;
}

h3 {
    font-size: 18px;
    color: #555;
    margin-bottom: 10px;
}

.subtitle {
    color: #666;
    font-size: 14px;
}

/* Uživatelské menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* Tlačítka */
.btn-back {
    display: inline-block;
    padding: 8px 16px;
    background-color: #6c757d;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.btn-back:hover {
    background-color: #5a6268;
}

.btn-detail {
    display: inline-block;
    padding: 6px 12px;
    background-color: #007bff;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    transition: background-color 0.3s;
}

.btn-detail:hover,
.btn-detail-active {
    background-color: #0056b3;
}

.btn-submit {
    padding: 10px 20px;
    background-color: #28a745;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-submit:hover {
    background-color: #218838;
}

.btn-delete-note {
    padding: 4px 8px;
    background-color: #dc3545;
    color: #fff;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.3s;
}

.btn-delete-note:hover {
    background-color: #c82333;
}

/* Vyhledávání */
.search-box {
    margin-bottom: 20px;
}

.search-box form {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-box input[type="text"] {
    flex: 1;
    max-width: 500px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.search-box button {
    padding: 10px 20px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.search-box button:hover {
    background-color: #0056b3;
}

.btn-clear {
    padding: 10px 20px;
    background-color: #6c757d;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn-clear:hover {
    background-color: #5a6268;
}

/* Tabulky */
.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: #fff;
}

thead {
    background-color: #f8f9fa;
}

th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #dee2e6;
}

td {
    padding: 10px 12px;
    border-bottom: 1px solid #dee2e6;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

.name {
    font-weight: 500;
}

.date {
    white-space: nowrap;
}

.actions {
    text-align: center;
    width: 100px;
}

.no-data {
    text-align: center;
    padding: 30px;
    color: #999;
    font-style: italic;
}

/* Semafor */
.semafor {
    text-align: center;
    width: 80px;
}

.semafor-icon {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #ddd;
}

.semafor-icon.zelena {
    background-color: #28a745;
    border-color: #1e7e34;
}

.semafor-icon.oranzova {
    background-color: #ffc107;
    border-color: #d39e00;
}

.semafor-icon.cervena {
    background-color: #dc3545;
    border-color: #bd2130;
}

.semafor-icon.seda {
    background-color: #6c757d;
    border-color: #545b62;
}

/* Ikona poznámky */
.note-icon {
    text-align: center;
    width: 80px;
}

.icon-note {
    font-size: 16px;
}

.icon-no-note {
    color: #ccc;
}

/* Stránkování */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-top: 30px;
    padding: 20px;
}

.btn-page {
    padding: 8px 16px;
    background-color: #007bff;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.btn-page:hover {
    background-color: #0056b3;
}

.page-info {
    color: #666;
}

/* Detail vlastníka */
.owner-info {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.info-item {
    display: flex;
    gap: 10px;
}

.info-item .label {
    font-weight: 600;
    color: #555;
    min-width: 140px;
}

.info-item .value {
    color: #333;
}

/* Sekce */
.section {
    margin-bottom: 40px;
}

/* Tabulka měřidel */
.meters-table tbody tr.odecteno {
    background-color: #d4edda;
}

.meters-table tbody tr.neodecteno {
    background-color: #f8d7da;
}

.meters-table .stav {
    font-weight: 600;
}

.neodecteno-text {
    color: #dc3545;
    font-weight: 500;
}

/* Formulář poznámky */
.add-note-form {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.add-note-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    margin-bottom: 10px;
    resize: vertical;
}

.message {
    padding: 10px;
    margin-top: 10px;
    border-radius: 4px;
}

.message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Seznam poznámek */
.notes-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.note-item {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    transition: box-shadow 0.3s;
}

.note-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.note-date {
    font-size: 12px;
    color: #666;
}

.note-author {
    font-size: 12px;
    color: #007bff;
    font-weight: 500;
}

.note-content {
    color: #333;
    line-height: 1.6;
}

/* User avatar */
.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

.user-avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.6);
}

/* Dropdown menu */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    background-color: #f8f9fa;
    color: #333;
    border: 2px solid #dee2e6;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.dropdown-toggle:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.dropdown.active .dropdown-toggle {
    background-color: #e9ecef;
    border-color: #667eea;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.3);
}

.dropdown-user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.2;
}

.dropdown-user-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.dropdown-user-role {
    font-size: 11px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dropdown-arrow {
    margin-left: auto;
    font-size: 10px;
    color: #6c757d;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 8px;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    min-width: 240px;
    z-index: 1000;
    overflow: hidden;
}

.dropdown.active .dropdown-menu {
    display: block;
    animation: dropdownFadeIn 0.2s ease-out;
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-header {
    padding: 16px;
    border-bottom: 1px solid #e9ecef;
    background-color: #f8f9fa;
    display: flex;
    align-items: center;
    gap: 12px;
}

.dropdown-header .user-avatar {
    width: 36px;
    height: 36px;
    font-size: 13px;
    flex-shrink: 0;
}

.dropdown-header-info {
    flex: 1;
    min-width: 0;
}

.dropdown-header-name {
    font-weight: 600;
    font-size: 14px;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dropdown-header-role {
    font-size: 12px;
    color: #6c757d;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    transition: background-color 0.2s;
    font-size: 14px;
    border: none;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

.dropdown-item-icon {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #6c757d;
}

.dropdown-divider {
    height: 1px;
    background-color: #e9ecef;
    margin: 4px 0;
}

.dropdown-item.logout {
    color: #dc3545;
}

.dropdown-item.logout:hover {
    background-color: #fff5f5;
}

.dropdown-item.logout .dropdown-item-icon {
    color: #dc3545;
}

/* ============================================
   Admin - Statistické karty
   ============================================ */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: box-shadow 0.2s;
}

.stat-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-card-icon.blue { background: #e3f2fd; }
.stat-card-icon.green { background: #e8f5e9; }
.stat-card-icon.red { background: #fce4ec; }
.stat-card-icon.orange { background: #fff3e0; }

.stat-card-info {
    flex: 1;
    min-width: 0;
}

.stat-card-value {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    line-height: 1.2;
}

.stat-card-label {
    font-size: 13px;
    color: #6c757d;
}

/* ============================================
   Admin - Badge styly
   ============================================ */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-admin {
    background-color: #fce4ec;
    color: #c62828;
}

.badge-user {
    background-color: #e8eaf6;
    color: #3949ab;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.active { background-color: #28a745; }
.status-dot.inactive { background-color: #dc3545; }

/* ============================================
   Admin - Akční tlačítka
   ============================================ */
.action-group {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-action.edit {
    background-color: #e3f2fd;
    color: #1565c0;
}
.btn-action.edit:hover {
    background-color: #bbdefb;
}

.btn-action.toggle {
    background-color: #fff3e0;
    color: #e65100;
}
.btn-action.toggle:hover {
    background-color: #ffe0b2;
}

.btn-action.reset {
    background-color: #f3e5f5;
    color: #7b1fa2;
}
.btn-action.reset:hover {
    background-color: #e1bee7;
}

.btn-action.delete {
    background-color: #fce4ec;
    color: #c62828;
}
.btn-action.delete:hover {
    background-color: #f8bbd0;
}

/* ============================================
   Admin - Formuláře
   ============================================ */
.admin-form-container {
    max-width: 640px;
    margin: 0 auto;
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.admin-form-container h2 {
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: 14px;
    color: #333;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.15);
}

.form-group input:disabled {
    background-color: #e9ecef;
    cursor: not-allowed;
}

.form-group small {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #6c757d;
}

.form-section {
    margin-top: 30px;
    padding-top: 25px;
    border-top: 2px solid #e9ecef;
}

.form-section h3 {
    margin-bottom: 20px;
    color: #495057;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-row .form-group {
    flex: 1;
}

.password-field-wrapper {
    position: relative;
    display: flex;
    gap: 8px;
}

.password-field-wrapper input {
    flex: 1;
}

.btn-generate {
    padding: 10px 14px;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-generate:hover {
    background-color: #dee2e6;
}

/* Password strength indicator */
.password-strength {
    margin-top: 8px;
}

.password-strength-bar {
    height: 4px;
    border-radius: 2px;
    background: #e9ecef;
    overflow: hidden;
    margin-bottom: 4px;
}

.password-strength-fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.3s, background-color 0.3s;
    width: 0;
}

.password-strength-text {
    font-size: 12px;
    color: #6c757d;
}

.password-requirements {
    font-size: 12px;
    color: #6c757d;
    margin-top: 6px;
    line-height: 1.5;
}

/* User info card in edit form */
.user-info-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 25px;
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.user-info-card .info-pair {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.user-info-card .info-pair .label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    font-weight: 600;
}

.user-info-card .info-pair .value {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

/* Tlačítko pro odeslání emailu v tabulce měřidel */
.btn-send-email {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-send-email:hover {
    background-color: #0056b3;
}

/* Hromadné akce */
.bulk-actions {
    display: flex;
    justify-content: flex-start;
    padding: 12px 0;
}

.btn-bulk-email {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background-color: #2563eb;
    color: #fff;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-bulk-email:hover:not(:disabled) {
    background-color: #1d4ed8;
}

.btn-bulk-email:disabled {
    background-color: #93c5fd;
    cursor: not-allowed;
}

.meter-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

#selectAllMeters {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.modal-meter-list {
    margin: 8px 0 0 0;
    padding-left: 20px;
    list-style: disc;
    color: #333;
    font-size: 13px;
    line-height: 1.6;
}

/* Email modal textarea */
#emailBody {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: #fff;
    border-radius: 8px;
    padding: 30px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal h3 {
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.btn-cancel {
    padding: 8px 16px;
    background-color: #e9ecef;
    color: #495057;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.btn-cancel:hover {
    background-color: #dee2e6;
}

/* Responzivní design */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    h1 {
        font-size: 22px;
    }

    header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .search-box form {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box input[type="text"] {
        max-width: 100%;
    }

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

    table {
        font-size: 12px;
    }

    th, td {
        padding: 8px;
    }

    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .action-group {
        flex-direction: column;
    }

    .user-info-card {
        flex-direction: column;
        gap: 12px;
    }
}
