/* Base Styles */
:root {
    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --success-color: #16a34a;
    --warning-color: #ca8a04;
    --error-color: #dc2626;
    --info-color: #0891b2;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 2rem;
}

header h1 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Form */
#domain-form {
    background: var(--surface);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.input-group {
    display: flex;
    gap: 0.5rem;
}

#domain-input {
    flex: 1;
    padding: 0.875rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

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

#domain-input.invalid {
    border-color: var(--error-color);
}

#check-button {
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    background-color: var(--primary-color);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    min-width: 100px;
}

#check-button:hover:not(:disabled) {
    background-color: var(--primary-hover);
}

#check-button:active:not(:disabled) {
    transform: scale(0.98);
}

#check-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

#check-button .button-loading {
    display: none;
}

#check-button.loading .button-text {
    display: none;
}

#check-button.loading .button-loading {
    display: inline;
}

.hint {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.error-message {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
    min-height: 1.25rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Loading Indicator */
.loading {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
    text-align: center;
    color: var(--text-secondary);
}

.loading.visible {
    display: flex;
}

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

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Score Card */
.score-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.score-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.score-header h2 {
    font-size: 1.25rem;
    color: var(--text-primary);
    word-break: break-all;
}

.timestamp {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.score-body {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 2rem;
}

.grade-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: white;
    flex-shrink: 0;
}

.grade-circle.grade-a { background: var(--success-color); }
.grade-circle.grade-b { background: #22c55e; }
.grade-circle.grade-c { background: var(--warning-color); }
.grade-circle.grade-d { background: #f97316; }
.grade-circle.grade-f { background: var(--error-color); }
.grade-circle.grade-unknown { background: var(--text-secondary); }

.score-details {
    flex: 1;
}

.score-value {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.status {
    font-weight: 500;
}

.status.found {
    color: var(--success-color);
}

.status.not-found {
    color: var(--error-color);
}

.expires {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Content Sections */
.content-section,
.validation-section,
.recommendations-section {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.content-section h3,
.validation-section h3,
.recommendations-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.fields-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.field-item {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--background);
    border-radius: var(--radius);
}

.field-name {
    font-weight: 600;
    min-width: 140px;
    color: var(--text-primary);
}

.field-value {
    flex: 1;
    word-break: break-all;
    color: var(--text-secondary);
}

.field-value a {
    color: var(--primary-color);
    text-decoration: none;
}

.field-value a:hover {
    text-decoration: underline;
}

/* Validation */
.validation-status {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    font-weight: 500;
}

.validation-status.valid {
    background: rgba(22, 163, 74, 0.1);
    color: var(--success-color);
}

.validation-status.invalid {
    background: rgba(220, 38, 38, 0.1);
    color: var(--error-color);
}

.issues-list {
    list-style: none;
}

.issues-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.issues-list li > :first-child {
    display: flex;
    gap: 0.5rem;
    align-items: flex-start;
}

.issues-list li:last-child {
    border-bottom: none;
}

.issue-severity {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
}

.issue-severity.error {
    background: rgba(220, 38, 38, 0.1);
    color: var(--error-color);
}

.issue-severity.warning {
    background: rgba(202, 138, 4, 0.1);
    color: var(--warning-color);
}

.issue-severity.info {
    background: rgba(8, 145, 178, 0.1);
    color: var(--info-color);
}

.issue-severity.critical {
    background: rgba(185, 28, 28, 0.1);
    color: #b91c1c;
}

.issue-recommendation {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    padding-left: 0.5rem;
    border-left: 2px solid var(--border-color);
    font-style: italic;
}

/* Recommendations */
.recommendations-list {
    list-style: none;
}

.recommendations-list li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-secondary);
}

.recommendations-list li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--primary-color);
}

/* Error Section */
.error-section,
.not-found-section {
    text-align: center;
}

.error-card,
.not-found-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 2rem;
}

.error-card h2 {
    color: var(--error-color);
    margin-bottom: 1rem;
}

.not-found-card h2 {
    color: var(--warning-color);
    margin-bottom: 1rem;
}

#error-details,
.not-found-message {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

#not-found-domain {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.retry-button {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--primary-color);
    background: transparent;
    border: 2px solid var(--primary-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.retry-button:hover {
    background: var(--primary-color);
    color: white;
}

.not-found-section .recommendations-section {
    text-align: left;
    margin-top: 1.5rem;
}

/* Footer */
footer {
    text-align: center;
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.875rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .input-group {
        flex-direction: column;
    }

    #check-button {
        width: 100%;
    }

    .score-body {
        flex-direction: column;
        text-align: center;
    }

    .field-item {
        flex-direction: column;
    }

    .field-name {
        min-width: auto;
    }
}

/* Hidden State */
[hidden] {
    display: none !important;
}
