/* Modern Dashboard Styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.dashboard {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding: 1rem 2rem;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
}

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

.header h1 {
    color: #4a5568;
    font-size: 1.8rem;
    font-weight: 600;
}

.header h1 i {
    color: #667eea;
    margin-right: 0.5rem;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(72, 187, 120, 0.1);
    border-radius: 20px;
    font-size: 0.9rem;
}

.status-indicator.connected i {
    color: #48bb78;
}

.status-indicator.disconnected i {
    color: #f56565;
}

.status-indicator.connecting i {
    color: #ed8936;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.last-update {
    font-size: 0.9rem;
    color: #666;
}

/* Button Styles */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a67d8;
    transform: translateY(-1px);
}

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

.btn.active {
    background: #4299e1;
    color: white;
}

/* Action Buttons Styling */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: nowrap;
}

.action-buttons .btn {
    white-space: nowrap;
    min-width: fit-content;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.action-buttons .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Simplified color scheme - using brand colors */
.btn-quota-generator,
.btn-quota {
    background: #667eea !important;
    color: white !important;
    font-weight: 500;
}

.btn-quota-generator:hover,
.btn-quota:hover {
    background: #5568d3 !important;
}

/* Experimental buttons column */
.experimental-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: nowrap;
}

.experimental-buttons .btn {
    background: #a0aec0 !important;
    color: white !important;
    font-weight: 500;
    opacity: 0.8;
    position: relative;
    overflow: visible;
}

.experimental-buttons .btn:hover {
    opacity: 1;
}

.btn-deprecated {
    text-decoration: line-through;
    opacity: 0.6 !important;
}

/* Badge styles for buttons */
.btn-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ef4444;
    color: white;
    font-size: 0.6rem;
    padding: 0.125rem 0.35rem;
    border-radius: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    z-index: 10;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
}

.btn-badge.badge-beta {
    background: #3b82f6;
}

.btn-badge.badge-deprecated {
    background: #6b7280;
}

.btn-badge.badge-new {
    background: #10b981;
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }

    .main-content {
        padding: 1rem;
    }

    .charts-section {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: stretch;
    }

    .table-controls {
        justify-content: stretch;
    }

    .search-input, .filter-select {
        flex: 1;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .action-buttons .btn {
        font-size: 0.7rem;
        padding: 0.25rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        flex-direction: column;
        text-align: center;
    }
}

.hidden {
    display: none !important;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 2rem;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

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

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.25rem;
}

.stat-content p {
    color: #718096;
    font-size: 0.9rem;
    font-weight: 500;
}

/* Charts Section */
.charts-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.chart-header h3 {
    color: #2d3748;
    font-size: 1.2rem;
    font-weight: 600;
}

.chart-controls {
    display: flex;
    gap: 0.5rem;
}

/* Forms Section */
.forms-section, .submissions-section {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h3 {
    color: #003449;
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.section-header h3 i {
    color: #00b1b7;
    font-size: 1.1rem;
}

.table-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-input, .filter-select {
    padding: 0.5rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

.search-input:focus, .filter-select:focus {
    outline: none;
    border-color: #667eea;
}

/* Table Styles */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.data-table th {
    background: #f7fafc;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: #4a5568;
    border-bottom: 2px solid #e2e8f0;
}

.data-table td {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
    color: #2d3748;
}

.data-table tr:hover {
    background: #f7fafc;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status-deployed {
    background: #c6f6d5;
    color: #22543d;
}

.status-draft {
    background: #fed7d7;
    color: #742a2a;
}

.status-archived {
    background: #e2e8f0;
    color: #4a5568;
}

/* Submissions List */
.submissions-list {
    max-height: 400px;
    overflow-y: auto;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.submission-item {
    padding: 1rem;
    border-bottom: 1px solid #e2e8f0;
    background: white;
    transition: background 0.3s ease;
}

.submission-item:hover {
    background: #f7fafc;
}

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

.submission-header {
    display: flex;
    justify-content: between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.submission-id {
    font-weight: 600;
    color: #2d3748;
}

.submission-time {
    font-size: 0.9rem;
    color: #718096;
}

.submission-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: #4a5568;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.loading-spinner i {
    font-size: 2rem;
    color: #667eea;
    margin-bottom: 1rem;
}

/* Notification */
.notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: #667eea;
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    transform: translateX(400px);
    transition: transform 0.3s ease;
    z-index: 1001;
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: #48bb78;
}

.notification.error {
    background: #f56565;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 1rem;
}

/* Webhook Status Styles */
.webhook-cell {
    min-width: 150px;
}

.webhook-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.85rem;
}

.webhook-status.webhook-none {
    color: #718096;
}

.webhook-status.webhook-active {
    color: #38a169;
}

.webhook-status.webhook-inactive {
    color: #718096;
}

.webhook-status.webhook-warning {
    color: #dd6b20;
}

.webhook-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.webhook-count {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.webhook-failures {
    color: #e53e3e;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.webhook-successes {
    color: #38a169;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.webhook-actions {
    display: flex;
    gap: 0.25rem;
}

.btn-mini {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-mini:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.btn-mini i {
    font-size: 0.75rem;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow: auto;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 16px 16px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
}

.modal-header .close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-body {
    padding: 1.5rem;
}

.modal-body p {
    margin: 0.5rem 0;
    color: #4a5568;
}

.modal-body strong {
    color: #2d3748;
}

.modal-body code {
    background: #f7fafc;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: #667eea;
}

/* Webhooks List in Modal */
.webhooks-list {
    margin-top: 1rem;
}

.webhook-item {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    background: #f7fafc;
}

.webhook-item:last-child {
    margin-bottom: 0;
}

.webhook-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.webhook-item-header h4 {
    margin: 0;
    color: #2d3748;
}

.webhook-item-details p {
    margin: 0.5rem 0;
    color: #4a5568;
}

.webhook-item-details code {
    background: #f7fafc;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #2d3748;
}

.webhooks-list {
    max-height: 400px;
    overflow-y: auto;
}

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

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

.form-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.85rem;
    color: #718096;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

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

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
}

/* Button Variants */
.btn-danger {
    background: #f56565;
    color: white;
}

.btn-danger:hover {
    background: #e53e3e;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.3);
}

.btn-warning {
    background: #ed8936;
    color: white;
}

.btn-warning:hover {
    background: #dd6b20;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(237, 137, 54, 0.3);
}

.btn-edit {
    background: #4299e1;
    color: white;
}

.btn-edit:hover {
    background: #3182ce;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 153, 225, 0.3);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

/* Webhook Actions Group */
.webhook-actions-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

/* Modal Improvements */
.modal-content {
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-body {
    padding: 1.5rem;
}

/* Webhook Item Styling */
.webhook-item {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.webhook-item:last-child {
    margin-bottom: 0;
}

.webhook-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.webhook-item-header h4 {
    margin: 0;
    color: #2d3748;
}

.webhook-item-details p {
    margin: 0.5rem 0;
    color: #4a5568;
}

.webhook-item-details code {
    background: #f7fafc;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #2d3748;
}

.webhooks-list {
    max-height: 400px;
    overflow-y: auto;
}

/* Scrollbar styling for webhook log */
.webhook-log-container::-webkit-scrollbar {
    width: 8px;
}

.webhook-log-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.webhook-log-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.webhook-log-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Webhook Log Specific Styles */
.webhook-log-container {
    max-height: 500px;
    overflow-y: auto;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    background: #f7fafc;
    padding: 1rem;
}

.webhook-log-empty {
    text-align: center;
    padding: 3rem 2rem;
    color: #718096;
}

.webhook-log-empty i {
    font-size: 3rem;
    opacity: 0.3;
    margin-bottom: 1rem;
    color: #cbd5e0;
}

.webhook-log-empty p {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #4a5568;
}

.webhook-log-empty small {
    font-size: 0.9rem;
    color: #718096;
}

.webhook-log-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.webhook-log-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f7fafc;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: #4a5568;
}

.webhook-log-status i {
    color: #fbbf24;
    animation: pulse 2s ease-in-out infinite;
}

.webhook-log-item {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.3s ease;
}

.webhook-log-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-color: #cbd5e0;
}

.webhook-log-item:last-child {
    margin-bottom: 0;
}

.webhook-log-item.new {
    animation: slideInRight 0.5s ease-out;
    border-left: 4px solid #10b981;
}

@keyframes slideInRight {
    from {
        transform: translateX(50px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}
