/* Global 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;
}

/* Login Page */
.login-page {
    background: #fff;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 10px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 10px;
    color: #333;
}

.login-box .subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
    font-size: 14px;
}

.login-hint {
    text-align: center;
    font-size: 12px;
    color: #999;
    margin-top: 20px;
}

/* Navbar */
.navbar {
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 15px 0;
    margin-bottom: 30px;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar h1 {
    font-size: 24px;
    color: #333;
}

.nav-links {
    display: flex;
    gap: 15px;
    align-items: center;
}

.user-info {
    color: #666;
    font-size: 14px;
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 40px;
}

/* Alerts */
.alert {
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}
.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-value {
    font-size: 48px;
    font-weight: bold;
    margin-bottom: 10px;
}

.stat-online .stat-value { color: #27ae60; }
.stat-offline .stat-value { color: #e74c3c; }
.stat-total .stat-value { color: #667eea; }

.stat-label {
    color: #666;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Toolbar */
.toolbar {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}

.search-input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
}

/* Devices Grid */
.devices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.device-card {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

.device-card.device-stale {
    border: 2px solid #f1c40f;
}

.device-card.device-stale {
    border: 2px solid #f1c40f;
}

.device-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.device-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.device-header h3 {
    font-size: 18px;
    color: #333;
}

.status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
}

.stale-pill {
    padding: 4px 10px;
    background: #f39c12;
    color: #fff;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 10px;
}

.screenshot-wrapper {
    margin-top: 10px;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

.screenshot-wrapper img {
    width: 100%;
    display: block;
}

.stale-pill {
    padding: 4px 10px;
    background: #f39c12;
    color: #fff;
    border-radius: 12px;
    font-size: 12px;
    margin-left: 10px;
}

.status-online {
    background: #d4edda;
    color: #155724;
}

.status-offline {
    background: #f8d7da;
    color: #721c24;
}

.status-unresponsive {
    background: #fff3cd;
    color: #856404;
}

.status-error {
    background: #fff3cd;
    color: #856404;
}

.device-info {
    margin-bottom: 15px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 600;
    color: #666;
    font-size: 14px;
}

.info-value {
    color: #333;
    font-size: 14px;
    text-align: right;
    word-break: break-all;
}

.info-value a {
    color: #667eea;
    text-decoration: none;
}

.info-value a:hover {
    text-decoration: underline;
}

.url-value {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.info-warning {
    background: #fffaf0;
    border-radius: 6px;
    padding: 6px 8px;
    margin-top: 8px;
}

.device-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

.btn-warning {
    background: #f39c12;
    color: white;
}

.btn-warning:hover {
    background: #e67e22;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    width: 100%;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #333;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="password"] {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #666;
}

/* Device Detail */
.device-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #eee;
}

.device-detail-header h2 {
    font-size: 32px;
    color: #333;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.detail-card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.detail-card.card-stale {
    border: 2px solid #e74c3c;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.2);
}

.detail-card h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 20px;
}

.info-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
}

.info-item:last-child {
    border-bottom: none;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.action-buttons .btn {
    width: 100%;
}

.screenshot-status {
    margin-top: 10px;
    font-size: 14px;
    display: none;
}

.screenshot-status.status-info {
    color: #2c3e50;
}

.screenshot-status.status-warning {
    color: #f39c12;
}

.screenshot-status.status-error {
    color: #e74c3c;
}

/* WiFi command feedback on device detail */
.wifi-feedback {
    margin-bottom: 12px;
    padding: 10px 12px;
    border-radius: 6px;
    font-size: 14px;
}
.wifi-feedback-ok {
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
}
.wifi-feedback-fail {
    background: #ffebee;
    border: 1px solid #ef9a9a;
}
.wifi-feedback .wifi-ok { color: #2e7d32; font-weight: 600; }
.wifi-feedback .wifi-fail { color: #c62828; font-weight: 600; }
.wifi-feedback .wifi-time { color: #666; font-size: 12px; margin-left: 4px; }

.settings-status { padding: 8px 12px; border-radius: 6px; }
.settings-status.settings-on { background: #e8f5e9; color: #2e7d32; }

/* Logs */
.logs-container {
    max-height: 400px;
    overflow-y: auto;
}

.logs-table {
    width: 100%;
    border-collapse: collapse;
}

.logs-table th,
.logs-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.logs-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    position: sticky;
    top: 0;
}

.logs-table tr:hover {
    background: #f8f9fa;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    overflow: auto;
}

.modal-content {
    background: white;
    margin: 50px auto;
    padding: 30px;
    border-radius: 10px;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.device-checkboxes {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 15px;
}

.checkbox-label {
    display: block;
    padding: 8px 0;
    cursor: pointer;
}

.checkbox-label input {
    margin-right: 8px;
}

/* Responsive */
@media (max-width: 768px) {
    .devices-grid {
        grid-template-columns: 1fr;
    }
    
    .detail-grid {
        grid-template-columns: 1fr;
    }
    
    .nav-container {
        flex-direction: column;
        gap: 15px;
    }
    
    .toolbar {
        flex-direction: column;
    }
    
    .search-input {
        width: 100%;
    }
}

