/* Global Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f97316;
    --background: #f8fafc;
    --surface: #ffffff;
    --border-color: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
}

html, body {
    height: 100%;
}

.container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    padding: 0 20px;
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #1e40af 100%);
    color: white;
    padding: 40px 0;
    margin-bottom: 40px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.header-content h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.header-content p {
    font-size: 1.1em;
    opacity: 0.9;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    margin-bottom: 40px;
}

/* Card Styles */
.card {
    background: var(--surface);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
    border: 1px solid var(--border-color);
}

.card h2 {
    font-size: 1.5em;
    margin-bottom: 25px;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
}

.card h3 {
    font-size: 1.2em;
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95em;
}

.form-group textarea,
.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1em;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-group textarea:focus,
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 0.85em;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Button Styles */
.button-group {
    display: flex;
    gap: 12px;
    margin-top: 25px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    flex: 1;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
    flex: 1;
}

.btn-secondary:hover {
    background-color: #475569;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(100, 116, 139, 0.4);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9em;
    background-color: var(--primary-color);
    color: white;
}

.btn-small:hover {
    background-color: var(--primary-hover);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Status Message */
.status-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 6px;
    display: none;
    font-weight: 500;
}

.status-message.success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.status-message.error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.status-message.info {
    background-color: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

.status-message.show {
    display: block;
}

/* Results Section */
.results-section {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.section-header h2 {
    margin: 0;
    border: none;
    padding: 0;
}

/* Table Styles */
.table-wrapper {
    overflow-x: auto;
    margin-bottom: 30px;
}

.results-table,
.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95em;
}

.results-table thead,
.history-table thead {
    background-color: #f1f5f9;
    border-bottom: 2px solid var(--border-color);
}

.results-table th,
.history-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
}

.results-table td,
.history-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.results-table tbody tr:hover,
.history-table tbody tr:hover {
    background-color: #f8fafc;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 0.85em;
    font-weight: 600;
    display: inline-block;
}

.status-badge.success {
    background-color: #d1fae5;
    color: #065f46;
}

.status-badge.failed {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-badge.timeout {
    background-color: #fef3c7;
    color: #92400e;
}

/* Graph Section */
.graph-section {
    margin-bottom: 30px;
    padding: 20px;
    background-color: #f8fafc;
    border-radius: 8px;
    text-align: center;
}

.graph-section h3 {
    margin-bottom: 15px;
    margin-top: 0;
}

#graph-image {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    box-shadow: var(--shadow);
}

/* Statistics Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #f0f9ff 0%, #f8fafc 100%);
    padding: 20px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    text-align: center;
}

.stat-card h4 {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2em;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
}

/* History Section */
.history-section {
    margin-bottom: 40px;
}

.history-table tbody tr:nth-child(even) {
    background-color: #f8fafc;
}

/* Footer */
.footer {
    background-color: var(--text-primary);
    color: white;
    padding: 20px;
    text-align: center;
    margin-top: auto;
    font-size: 0.9em;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(37, 99, 235, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .header-content h1 {
        font-size: 1.8em;
    }

    .header-content p {
        font-size: 1em;
    }

    .card {
        padding: 20px;
    }

    .button-group {
        flex-direction: column;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .results-table,
    .history-table {
        font-size: 0.85em;
    }

    .results-table th,
    .results-table td,
    .history-table th,
    .history-table td {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }

    .header {
        padding: 20px 0;
        margin-bottom: 20px;
    }

    .header-content h1 {
        font-size: 1.4em;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        gap: 10px;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
}

.hidden {
    display: none;
}
