/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

/* Navigation */
nav {
    background: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand h1 {
    font-size: 1.5rem;
    font-weight: 600;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-menu a {
    color: white;
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: background 0.3s;
}

.nav-menu a:hover,
.nav-menu a.active {
    background: #34495e;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.alert-error {
    background: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.alert-success {
    background: #efe;
    color: #3c3;
    border: 1px solid #cfc;
}

/* Login page */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
}

.login-box {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.login-box h2 {
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: background 0.3s;
}

.btn-primary {
    background: #3498db;
    color: white;
    width: 100%;
}

.btn-primary:hover {
    background: #2980b9;
}

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

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

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-card h3 {
    font-size: 0.9rem;
    color: #7f8c8d;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 600;
    color: #2c3e50;
}

.status-indicator {
    font-size: 1.2rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    text-align: center;
}

.status-active {
    background: #2ecc71;
    color: white;
}

.status-idle {
    background: #3498db;
    color: white;
}

.status-offline {
    background: #95a5a6;
    color: white;
}

/* Device status */
.device-status {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.device-status h3 {
    margin-bottom: 1rem;
}

.device-status table {
    width: 100%;
}

.device-status table td {
    padding: 0.5rem;
}

.device-status table td:first-child {
    font-weight: 600;
    width: 200px;
}

/* Daily stats */
.daily-stats,
.stats-overview,
.daily-stats-table {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.daily-stats h3,
.daily-stats-table h3 {
    margin-bottom: 1rem;
}

.daily-stats table,
.daily-stats-table table,
.payments-table table {
    width: 100%;
    border-collapse: collapse;
}

.daily-stats th,
.daily-stats td,
.daily-stats-table th,
.daily-stats-table td,
.payments-table th,
.payments-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

.daily-stats th,
.daily-stats-table th,
.payments-table th {
    background: #ecf0f1;
    font-weight: 600;
}

.daily-stats tbody tr:hover,
.daily-stats-table tbody tr:hover,
.payments-table tbody tr:hover {
    background: #f8f9fa;
}

.daily-stats-table tfoot td {
    background: #ecf0f1;
    font-weight: 600;
}

/* Logs */
.recent-logs {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.recent-logs h3 {
    margin-bottom: 1rem;
}

.log-list {
    margin-bottom: 1rem;
}

.log-container {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}

.log-entry {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    border-left: 4px solid;
}

.log-entry .log-time {
    color: #7f8c8d;
    margin-right: 1rem;
}

.log-entry .log-level {
    font-weight: 600;
    margin-right: 1rem;
    display: inline-block;
    width: 80px;
}

.log-trace {
    background: #ecf0f1;
    border-left-color: #95a5a6;
}

.log-info {
    background: #e8f5e9;
    border-left-color: #4caf50;
}

.log-notice {
    background: #e3f2fd;
    border-left-color: #2196f3;
}

.log-warning {
    background: #fff3e0;
    border-left-color: #ff9800;
}

.log-error {
    background: #ffebee;
    border-left-color: #f44336;
}

/* Filter bar */
.filter-bar,
.stats-filter {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.filter-bar form,
.stats-filter form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.filter-bar select,
.filter-bar input,
.stats-filter select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.pagination span {
    color: #7f8c8d;
}

/* Payments table */
.payments-table {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}

/* Headings */
h2 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }

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

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar form {
        justify-content: space-between;
    }
}