:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1f2937;
    --light: #f9fafb;
    --gray-200: #e5e7eb;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    --radius: 12px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    color: var(--dark);
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100vw;
}

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

/* HEADER */
.header {
    background: white;
    border-radius: var(--radius);
    padding: 24px 32px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    border-left: 5px solid var(--primary);
}

.logo {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--primary), #3b82f6);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
}

.logo-text h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.logo-text p {
    color: #6b7280;
    font-size: 14px;
}

/* STATS CARDS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
}

.stat-content h3 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 4px;
}

.stat-content p {
    color: #6b7280;
    font-size: 14px;
}

.icon-uptime { background: linear-gradient(135deg, #10b981, #34d399); }
.icon-incidents { background: linear-gradient(135deg, #f59e0b, #fbbf24); }
.icon-response { background: linear-gradient(135deg, #3b82f6, #60a5fa); }
.icon-alerts { background: linear-gradient(135deg, #8b5cf6, #a78bfa); }

/* URL MANAGEMENT STYLES */
.url-actions {
    display: flex;
    gap: 8px;
}

.url-action-btn {
    padding: 6px 12px;
    border: 1px solid var(--gray-200);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    min-height: 32px;
}

.url-action-btn:hover {
    background: #f9fafb;
}

.btn-test {
    color: var(--primary);
    border-color: var(--primary);
}

.btn-test:hover {
    background: rgba(37, 99, 235, 0.1);
}

.btn-edit {
    color: #f59e0b;
    border-color: #f59e0b;
}

.btn-edit:hover {
    background: rgba(245, 158, 11, 0.1);
}

.btn-delete {
    color: var(--danger);
    border-color: var(--danger);
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.1);
}

.url-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
    font-size: 11px;
    color: #6b7280;
}

.url-stat {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

/* STATUS BADGES */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.status-down {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.status-up {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.status-pending {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.status-paused {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
}

.status-unknown {
    background: rgba(156, 163, 175, 0.1);
    color: #6b7280;
}

/* TOGGLE SWITCH STYLES */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--success);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--success);
}

input:checked + .slider:before {
    transform: translateX(22px);
}

/* Disabled toggle state */
.switch input:disabled + .slider {
    opacity: 0.6;
    cursor: not-allowed;
}

.switch input:disabled + .slider:before {
    opacity: 0.6;
}

/* MODAL STYLES */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1002;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideUp 0.3s ease-out;
}

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

.modal-header {
    padding: 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--dark);
}

.form-input {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-help {
    display: block;
    margin-top: 6px;
    color: #6b7280;
    font-size: 12px;
}

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

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

/* Fixed interval display */
.fixed-interval-display {
    background: #f0f9ff;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    padding: 12px 16px;
    color: #1d4ed8;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
}

.fixed-interval-display i {
    color: #3b82f6;
}

.interval-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #3b82f6;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
}

/* EMPTY STATE */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #6b7280;
}

.empty-state-icon {
    font-size: 48px;
    color: var(--gray-200);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
    color: var(--dark);
}

.empty-state p {
    margin-bottom: 20px;
    font-size: 14px;
}

/* MAIN TABLE CARD */
.main-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 24px;
}

.card-header {
    padding: 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 {
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-header h2 i {
    color: var(--primary);
}

.controls {
    display: flex;
    gap: 12px;
}

.btn {
    padding: 10px 20px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    touch-action: manipulation;
    user-select: none;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 2px solid var(--gray-200);
}

.btn-outline:hover {
    border-color: var(--primary);
    background: #f0f9ff;
}

/* TABLE */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.downtime-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 700px;
}

.downtime-table thead {
    background: #f9fafb;
}

.downtime-table th {
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    font-size: 14px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--gray-200);
}

.downtime-table td {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    font-size: 14px;
}

.downtime-table tbody tr:hover {
    background: #f0f9ff;
}

/* UPTIME COLORS */
.uptime-good {
    color: var(--success);
    font-weight: 600;
}

.uptime-warning {
    color: var(--warning);
    font-weight: 600;
}

.uptime-danger {
    color: var(--danger);
    font-weight: 600;
}

/* QUICK ACTIONS */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.action-card {
    background: white;
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    transition: transform 0.3s;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.action-card:hover {
    transform: translateY(-5px);
}

.action-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    background: linear-gradient(135deg, #3b82f6, #60a5fa);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    margin-bottom: 16px;
}

.action-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.action-card p {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 16px;
}

.action-btn {
    padding: 8px 16px;
    background: #f0f9ff;
    color: var(--primary);
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    width: 100%;
    justify-content: center;
}

/* WHATSAPP BUTTON - FLOATING */
.whatsapp-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
}

.whatsapp-button {
    width: 70px;
    height: 70px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.3);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    position: relative;
}

.whatsapp-button:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(37, 211, 102, 0.4);
    background: #128C7E;
}

.whatsapp-button::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: inherit;
    animation: pulse 2s infinite;
    z-index: -1;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 0.7; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* WHATSAPP CHAT MODAL */
.whatsapp-modal {
    position: fixed;
    bottom: 120px;
    right: 30px;
    width: 380px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
    z-index: 1001;
    overflow: hidden;
    display: none;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.whatsapp-header {
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.whatsapp-avatar {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.whatsapp-info h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 4px;
}

.whatsapp-info p {
    font-size: 13px;
    opacity: 0.9;
}

.whatsapp-body {
    padding: 20px;
    background: #f0f2f5;
    min-height: 400px;
    max-height: 500px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.whatsapp-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.4;
    font-size: 14px;
    word-wrap: break-word;
}

.message-incoming {
    background: white;
    align-self: flex-start;
    border-bottom-left-radius: 5px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message-outgoing {
    background: #dcf8c6;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.whatsapp-input-container {
    padding: 16px;
    border-top: 1px solid var(--gray-200);
    background: white;
    display: flex;
    gap: 12px;
}

.whatsapp-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid var(--gray-200);
    border-radius: 24px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    outline: none;
}

.whatsapp-input:focus {
    border-color: #25D366;
}

.whatsapp-send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #25D366;
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 48px;
}

.whatsapp-send-btn:hover {
    background: #128C7E;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    min-height: 30px;
}

/* LOADING STATES */
.loading {
    padding: 40px;
    text-align: center;
    color: #6b7280;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* API STATUS INDICATOR */
.api-status {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.status-connected {
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
}

.status-disconnected {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* Toast Styles */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 9999;
    animation: slideIn 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    font-weight: 500;
}

.toast.success {
    background: #10b981;
}

.toast.warning {
    background: #f59e0b;
}

.toast.error {
    background: #ef4444;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .header {
        flex-direction: column;
        text-align: center;
        gap: 20px;
        padding: 20px;
    }
    
    .logo {
        flex-direction: column;
        gap: 12px;
    }
    
    .logo-text h1 {
        font-size: 1.5rem;
    }
    
    .logo-text p {
        font-size: 0.9rem;
    }
    
    .controls {
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .controls .btn {
        flex: 1;
        min-width: 120px;
        font-size: 0.9rem;
        padding: 10px 12px;
        justify-content: center;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-card {
        padding: 20px;
        gap: 15px;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .stat-content h3 {
        font-size: 1.8rem;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .action-card {
        padding: 20px;
    }
    
    .action-btn {
        width: 100%;
        justify-content: center;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding: 20px;
    }
    
    .card-header .controls {
        width: 100%;
        justify-content: flex-start;
    }
    
    .url-actions {
        flex-direction: column;
    }
    
    .url-action-btn {
        justify-content: center;
    }
    
    .whatsapp-modal {
        width: 95%;
        height: 80vh;
        bottom: 80px;
        right: 2.5%;
        left: 2.5%;
        top: auto;
        transform: none;
    }
    
    .whatsapp-body {
        min-height: 300px;
        max-height: calc(80vh - 200px);
    }
    
    .whatsapp-float {
        bottom: 20px;
        right: 20px;
    }
    
    .whatsapp-button {
        width: 60px;
        height: 60px;
        font-size: 28px;
    }
    
    /* Hide less important columns on mobile */
    .downtime-table th:nth-child(5),
    .downtime-table td:nth-child(5),
    .downtime-table th:nth-child(6),
    .downtime-table td:nth-child(6) {
        display: none;
    }
    
    .downtime-table {
        min-width: 600px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    .header {
        padding: 15px;
    }
    
    .api-status {
        top: 10px;
        left: 10px;
        right: 10px;
        justify-content: center;
    }
    
    .status-badge {
        padding: 4px 8px;
        font-size: 0.75rem;
    }
    
    input, select, textarea {
        font-size: 16px;
    }
}