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

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

header {
    margin-bottom: 40px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

h1 {
    font-size: 2.5rem;
    color: #2c3e50;
    margin-bottom: 10px;
}

.subtitle {
    color: #7f8c8d;
    font-size: 1.1rem;
}

.header-nav {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logged-in-user {
    color: #7f8c8d;
    font-size: 0.9rem;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.metric-card {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.2s;
}

.metric-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}

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

.metric-value {
    font-size: 3rem;
    font-weight: bold;
    color: #3498db;
    line-height: 1;
}

.metric-unit {
    color: #95a5a6;
    font-size: 1.2rem;
    margin-top: 5px;
}

.charts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.chart-container {
    background: white;
    border-radius: 10px;
    padding: 25px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: relative;
    height: 300px;
    display: flex;
    flex-direction: column;
}

.chart-container h3 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.2rem;
    flex-shrink: 0;
}

canvas {
    width: 100% !important;
    height: 200px !important;
    display: block;
}

.retention-section {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin: 20px 0;
}

.retention-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.retention-stats {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 20px;
}

.retention-stats span {
    color: #7f8c8d;
}

.retention-stats strong {
    color: #2c3e50;
    font-weight: 600;
}

footer {
    text-align: center;
    color: #7f8c8d;
    padding: 20px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.logout-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

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

.analytics-btn {
    background: #9b59b6;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    margin-right: 10px;
}

.analytics-btn:hover {
    background: #8e44ad;
}

#last-update {
    font-weight: bold;
    color: #3498db;
}

.alerts-section {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    margin: 20px 0;
}

.alerts-section h3 {
    color: #2c3e50;
    margin-bottom: 15px;
}

.alert-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.alert-status {
    display: flex;
    gap: 30px;
}

.alert-status span {
    color: #7f8c8d;
}

.alert-status strong {
    color: #2c3e50;
    font-weight: 600;
}

.config-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}

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

.alert-history h4 {
    color: #7f8c8d;
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.alert-list {
    min-height: 50px;
    max-height: 200px;
    overflow-y: auto;
}

.no-alerts {
    color: #95a5a6;
    font-style: italic;
}

.alert-item {
    padding: 8px;
    margin: 5px 0;
    border-left: 3px solid #e74c3c;
    background: #fef5f5;
    border-radius: 4px;
}

.alert-item.warning {
    border-left-color: #f39c12;
    background: #fef9e7;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-content h2 {
    color: #2c3e50;
    margin-bottom: 20px;
}

.config-form h3 {
    color: #34495e;
    margin: 20px 0 10px;
    font-size: 1.1rem;
}

.threshold-group {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 15px;
}

.email-config {
    display: grid;
    gap: 10px;
}

.config-form label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #555;
}

.config-form input[type="number"],
.config-form input[type="text"],
.config-form input[type="email"],
.config-form input[type="password"] {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.config-form input[type="checkbox"] {
    width: 20px;
    height: 20px;
}

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

.save-btn {
    background: #27ae60;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
}

.save-btn:hover {
    background: #229954;
}

.cancel-btn {
    background: #95a5a6;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
}

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

@media (max-width: 768px) {
    .charts-section {
        grid-template-columns: 1fr;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .metric-card {
        padding: 20px;
    }
    
    .metric-value {
        font-size: 2.5rem;
    }
    
    .alert-controls {
        flex-direction: column;
        gap: 15px;
    }
    
    .alert-status {
        flex-direction: column;
        gap: 10px;
    }
}

/* Process Monitoring Styles */
.processes-section {
    background: white;
    border-radius: 10px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.process-stats {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    align-items: center;
    flex-wrap: wrap;
}

.process-stats span {
    background: #f8f9fa;
    padding: 8px 16px;
    border-radius: 5px;
    font-size: 0.9rem;
}

.refresh-btn {
    margin-left: auto;
    background: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

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

.process-tables {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.process-table-container {
    overflow-x: auto;
    max-height: 300px;
    overflow-y: auto;
}

.process-table-container h4 {
    margin-bottom: 10px;
    color: #2c3e50;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
    padding-top: 5px;
}

.process-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.process-table thead {
    background: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 5;
}

.process-table th,
.process-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.process-table th {
    font-weight: 600;
    color: #495057;
    background: #f8f9fa;
}

.process-table tbody tr:hover {
    background: #f8f9fa;
}

@media (max-width: 768px) {
    .process-tables {
        grid-template-columns: 1fr;
    }
}

/* Webhook Styles */
.webhooks-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.api-keys-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.status-pages-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.status-pages-info {
    margin-top: 10px;
    color: #666;
    font-size: 0.9em;
}

.status-pages-controls {
    margin: 15px 0;
}

.status-pages-list {
    margin-top: 20px;
}

.status-page-item {
    background: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-page-info strong {
    display: block;
    margin-bottom: 5px;
    color: #333;
}

.status-page-info p {
    margin: 5px 0;
    color: #666;
    font-size: 0.9em;
}

.status-page-url {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.status-page-url a {
    color: #2196F3;
    text-decoration: none;
    font-family: monospace;
    font-size: 0.85em;
}

.status-page-url a:hover {
    text-decoration: underline;
}

.copy-btn {
    background: #2196F3;
    color: white;
    border: none;
    padding: 4px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
}

.copy-btn:hover {
    background: #1976D2;
}

.status-page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: bold;
}

.status-badge.public {
    background: #4CAF50;
    color: white;
}

.status-badge.private {
    background: #666;
    color: white;
}

.delete-btn {
    background: #f44336;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
}

.delete-btn:hover {
    background: #d32f2f;
}

.export-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.export-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.export-controls label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.export-controls select {
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
}

.export-btn {
    background: #27ae60;
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.export-btn:hover {
    background: #219a52;
}

.api-keys-info {
    margin-top: 15px;
    font-size: 0.9rem;
    color: #666;
}

.api-keys-info code {
    background: #f5f5f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: monospace;
}

.webhook-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.webhook-list {
    min-height: 50px;
    max-height: 200px;
    overflow-y: auto;
}

.webhook-item {
    padding: 8px;
    border-bottom: 1px solid #eee;
    font-size: 0.9em;
}

.webhook-item:last-child {
    border-bottom: none;
}

.webhook-status-success {
    color: #27ae60;
}

.webhook-status-failed {
    color: #e74c3c;
}

.webhook-list-container {
    margin-bottom: 20px;
}

#configured-webhooks {
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    margin-bottom: 10px;
    max-height: 200px;
    overflow-y: auto;
}

.webhook-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.webhook-list-item:last-child {
    border-bottom: none;
}

.webhook-events {
    display: flex;
    gap: 15px;
    margin-top: 5px;
}

.webhook-buttons {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.test-btn {
    background-color: #f39c12;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

.test-btn:hover {
    background-color: #e67e22;
}

.add-btn {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

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

.no-webhooks {
    color: #666;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

.edit-btn, .delete-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85em;
}

.edit-btn {
    background-color: #3498db;
    color: white;
    margin-right: 5px;
}

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

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

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

/* API Key Modal Styles */
.api-keys-list-container {
    margin-bottom: 20px;
}

#api-keys-list {
    margin: 15px 0;
    max-height: 300px;
    overflow-y: auto;
}

.api-key-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 5px;
    margin-bottom: 10px;
}

.api-key-info {
    flex: 1;
}

.api-key-name {
    font-weight: bold;
    margin-bottom: 5px;
}

.api-key-meta {
    font-size: 0.85rem;
    color: #666;
}

.api-key-permissions {
    margin: 10px 0;
}

.api-key-permissions label {
    display: block;
    margin: 5px 0;
}

.api-key-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.api-key-value {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 15px;
}

.api-key-value code {
    flex: 1;
    word-break: break-all;
    font-family: monospace;
}

.copy-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 5px 15px;
    border-radius: 3px;
    cursor: pointer;
}

/* Feedback Styles */
.feedback-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 16px;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
    transition: all 0.3s ease;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
}

.feedback-button:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(52, 152, 219, 0.4);
}

.feedback-icon {
    font-size: 20px;
}

#feedback-modal {
    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;
}

#feedback-modal.show {
    display: flex;
}

.feedback-content {
    background: white;
    border-radius: 10px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideIn 0.3s ease;
}

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

.feedback-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.feedback-header h2 {
    margin: 0;
    color: #2c3e50;
}

.feedback-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #7f8c8d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.feedback-close:hover {
    background: #f5f5f5;
}

.feedback-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.feedback-form label {
    color: #2c3e50;
    font-weight: 500;
    margin-bottom: 5px;
    display: block;
}

.feedback-form input,
.feedback-form select,
.feedback-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.feedback-form input:focus,
.feedback-form select:focus,
.feedback-form textarea:focus {
    outline: none;
    border-color: #3498db;
}

.feedback-form textarea {
    min-height: 120px;
    resize: vertical;
}

.feedback-type-buttons {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.type-button {
    flex: 1;
    padding: 10px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    font-size: 14px;
}

.type-button.active {
    background: #3498db;
    color: white;
    border-color: #3498db;
}

.type-button:hover:not(.active) {
    border-color: #3498db;
    background: #f8f9fa;
}

.feedback-submit {
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    margin-top: 10px;
    transition: background 0.2s;
}

.feedback-submit:hover {
    background: #2980b9;
}

.feedback-submit:disabled {
    background: #95a5a6;
    cursor: not-allowed;
}

.feedback-success {
    background: #27ae60;
    color: white;
    padding: 15px;
    border-radius: 5px;
    text-align: center;
    margin-top: 20px;
    animation: slideIn 0.3s ease;
}

.feedback-error {
    background: #e74c3c;
    color: white;
    padding: 15px;
    border-radius: 5px;
    text-align: center;
    margin-top: 20px;
    animation: slideIn 0.3s ease;
}

.optional-label {
    color: #7f8c8d;
    font-size: 12px;
    font-weight: normal;
}

/* Demo banner styles */
.demo-banner {
    background: #f39c12;
    color: white;
    padding: 12px 20px;
    margin: 0 0 20px 0;
    border-radius: 5px;
    animation: slideDown 0.3s ease;
}

.demo-banner-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.demo-banner-text {
    font-size: 14px;
}

.demo-banner-actions {
    display: flex;
    gap: 10px;
}

.upgrade-btn {
    background: white;
    color: #f39c12;
    border: none;
    padding: 8px 16px;
    border-radius: 3px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
}

.upgrade-btn:hover {
    background: #fff3cd;
    transform: translateY(-1px);
}
.upgrade-btn.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: .95;
        transform: scale(1.05);
    }
}

.dismiss-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0 5px;
    transition: opacity 0.2s;
}

.dismiss-btn:hover {
    opacity: 0.7;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

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

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 30px;
    border-radius: 10px;
    width: 90%;
    max-width: 600px;
    position: relative;
    animation: slideIn 0.3s ease;
}

.modal-close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.modal-close:hover {
    color: #000;
}

.feature-comparison {
    margin: 30px 0;
}

.comparison-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

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

.comparison-table th {
    background-color: #f8f9fa;
    font-weight: bold;
}

.comparison-table td:nth-child(2) {
    color: #e74c3c;
}

.comparison-table td:nth-child(3) {
    color: #27ae60;
    font-weight: bold;
}

.upgrade-cta {
    text-align: center;
    margin-top: 30px;
}

.upgrade-action-btn {
    background: #27ae60;
    color: white;
    border: none;
    padding: 15px 30px;
    font-size: 18px;
    border-radius: 5px;
    cursor: pointer;
    margin: 15px 0;
    transition: all 0.3s;
}

.upgrade-action-btn:hover {
    background: #219a52;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.3);
}

.upgrade-note {
    color: #7f8c8d;
    font-size: 14px;
}