/* AnnaCare Dashboard Styles */
:root {
    --primary-blue: #5DADE2;
    --secondary-blue: #3B5998;
    --light-gray: #f5f6fa;
    --border-gray: #dcdde1;
    --text-dark: #2f3640;
    --success-green: #27ae60;
    --warning-orange: #f39c12;
    --danger-red: #e74c3c;
    --offline-gray: #95a5a6;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--light-gray);
    color: var(--text-dark);
    line-height: 1.6;
}

header {
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    color: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1600px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

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

.facility-name {
    font-size: 0.85rem;
    opacity: 0.9;
    font-weight: 400;
}

.header-right {
    display: flex;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.user-role {
    font-size: 0.75rem;
    opacity: 0.9;
}

.logo {
    height: 50px;
    background: white;
    padding: 0.5rem;
    border-radius: 4px;
}

header h1 {
    font-size: 1.8rem;
    font-weight: 600;
}

main {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem 2rem 4rem 2rem;
    min-height: calc(100vh - 200px);
}

.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.stat-card {
    background: white;
    padding: 1.25rem;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid var(--border-gray);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stat-label {
    font-size: 0.85rem;
    color: #7f8c8d;
    font-weight: 500;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--text-dark);
}

.stat-value.stat-small {
    font-size: 0.95rem;
    font-weight: 500;
}

.stat-value.stat-success {
    color: var(--success-green);
}

.stat-value.stat-warning {
    color: var(--warning-orange);
}

.overview-container {
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid var(--border-gray);
    overflow: hidden;
}

/* Table Styles */
.devices-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.devices-table thead {
    background: #f8f9fa;
    color: var(--text-dark);
    border-bottom: 2px solid var(--border-gray);
}

.devices-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-bottom: 2px solid var(--border-gray);
    color: var(--secondary-blue);
}

.devices-table td {
    padding: 1rem;
    border-bottom: 1px solid #e8e9ea;
    vertical-align: middle;
}

.devices-table tbody tr {
    transition: background-color 0.15s ease;
}

.devices-table tbody tr:hover {
    background-color: #f8f9fb;
}

.devices-table tbody tr:nth-child(even) {
    background-color: #fafbfc;
}

.devices-table tbody tr:nth-child(even):hover {
    background-color: #f5f6f8;
}

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

/* Value Display */
.value-display {
    display: flex;
    flex-direction: column;
}

.value-main {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
}

.value-since {
    font-size: 0.75rem;
    color: #7f8c8d;
    margin-top: 0.2rem;
}

.value-null {
    color: #95a5a6;
    font-size: 1.1rem;
    font-weight: 500;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-online {
    background-color: #d4edda;
    color: #155724;
}

.status-offline {
    background-color: #f8d7da;
    color: #721c24;
}

.alarm-badge {
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.alarm-immediate {
    background-color: #fee;
    color: var(--danger-red);
}

.alarm-delayed {
    background-color: #fff3cd;
    color: #856404;
}

.alarm-preventative {
    background-color: #d1ecf1;
    color: #0c5460;
}

.alarm-deactivated {
    background-color: #e2e3e5;
    color: #383d41;
}

/* Buttons */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary-blue);
    color: white;
}

.btn-primary:hover {
    background-color: #4a9fd8;
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.2s;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s;
}

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

.settings-modal-content {
    width: 90%;
    max-width: 500px;
}

.history-modal-content {
    width: 95%;
    max-width: 1200px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-gray);
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    color: white;
    border-radius: 8px 8px 0 0;
}

.modal-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
}

.close {
    font-size: 2rem;
    font-weight: 300;
    color: white;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

.close:hover {
    color: #ecf0f1;
}

.modal-body {
    padding: 2rem;
}

.device-name-display {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--secondary-blue);
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-blue);
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-dark);
}

.form-control {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-blue);
}

.sub-group {
    margin-top: 1rem;
    padding-left: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    justify-content: flex-end;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-gray);
}

.tab-button {
    padding: 0.8rem 1.5rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: #7f8c8d;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.tab-button:hover {
    color: var(--secondary-blue);
}

.tab-button.active {
    color: var(--secondary-blue);
    border-bottom-color: var(--primary-blue);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Alarm History Table */
.alarm-history-table {
    width: 100%;
    border-collapse: collapse;
}

.alarm-history-table thead {
    background-color: var(--light-gray);
}

.alarm-history-table th {
    padding: 0.8rem;
    text-align: left;
    font-weight: 600;
    color: var(--secondary-blue);
    border-bottom: 2px solid var(--border-gray);
}

.alarm-history-table td {
    padding: 0.8rem;
    border-bottom: 1px solid var(--border-gray);
}

.alarm-history-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Measurements */
.measurement-controls {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--light-gray);
    border-radius: 4px;
}

.measurement-controls label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.measurement-controls input[type="checkbox"] {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.day-section {
    margin-bottom: 2rem;
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    overflow: hidden;
}

.day-header {
    background-color: var(--secondary-blue);
    color: white;
    padding: 0.8rem 1rem;
    font-weight: 600;
}

.day-graphs {
    padding: 1rem;
    background-color: white;
}

.graph-container {
    margin-bottom: 0.5rem;
}

.graph-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--secondary-blue);
    margin-bottom: 0.3rem;
}

.graph-canvas {
    width: 100%;
    height: 60px;
    border: 1px solid var(--border-gray);
    border-radius: 4px;
}

/* Demo Watermark */
.demo-watermark {
    position: absolute;
    top: 50%;
    right: 2rem;
    transform: translateY(-50%);
    font-size: 3rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.15);
    pointer-events: none;
    z-index: 1;
    user-select: none;
    letter-spacing: 0.5rem;
}

/* Footer */
footer {
    background: #2c3e50;
    color: #ecf0f1;
    padding: 1.5rem 2rem;
    border-top: 3px solid var(--primary-blue);
    margin-top: auto;
}

.footer-content {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-left {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.footer-copyright {
    font-size: 0.85rem;
}

.footer-version {
    font-size: 0.75rem;
    opacity: 0.7;
}

.footer-right {
    display: flex;
    gap: 2rem;
}

.footer-link {
    color: #ecf0f1;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s;
}

.footer-link:hover {
    color: var(--primary-blue);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .devices-table {
        font-size: 0.9rem;
    }

    .devices-table th,
    .devices-table td {
        padding: 0.8rem 0.5rem;
    }
}

@media (max-width: 1200px) {
    .dashboard-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .demo-watermark {
        font-size: 2rem;
        letter-spacing: 0.3rem;
    }
}

@media (max-width: 768px) {
    header {
        padding: 1rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .header-left {
        flex-direction: column;
        text-align: center;
    }

    .user-info {
        width: 100%;
        justify-content: center;
    }

    main {
        padding: 1rem;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .demo-watermark {
        font-size: 1.5rem;
        letter-spacing: 0.2rem;
        right: 1rem;
    }

    .devices-table {
        font-size: 0.8rem;
    }

    .measurement-controls {
        flex-direction: column;
        gap: 0.8rem;
    }

    .footer-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .footer-right {
        flex-direction: column;
        gap: 0.5rem;
    }
}
