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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #1f2937;
    background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 50%, #f3e8ff 100%);
    min-height: 100vh;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

.container {
    max-width: 1024px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(229, 231, 235, 0.8);
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0;
}

.logo {
    width: 2.5rem;
    height: 2.5rem;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.title {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

/* Main Content */
.main {
    padding: 2rem 0;
}

/* Cards */
.card {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-radius: 1rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(229, 231, 235, 0.8);
    padding: 1.5rem;
    margin-bottom: 2rem;
    transition: all 0.3s ease;
}

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

/* Form Elements */
.form-group {
    margin-bottom: 1rem;
}

.label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.input-wrapper {
    position: relative;
}

textarea {
    width: 100%;
    padding: 0.75rem 3rem 0.75rem 1rem;
    border: 1px solid #d1d5db;
    border-radius: 0.75rem;
    font-size: 1rem;
    resize: vertical;
    transition: all 0.2s ease;
    background: white;
}

textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.input-icon {
    position: absolute;
    right: 1rem;
    top: 1rem;
    color: #9ca3af;
    width: 1.25rem;
    height: 1.25rem;
}

/* Buttons */
.btn-primary {
    width: 100%;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.75rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

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

/* Card Headers */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Regex Display */
.regex-display {
    background: #f9fafb;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-bottom: 1rem;
}

.regex-display code {
    font-size: 1.125rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    color: #111827;
    word-break: break-all;
}

/* Explanation Section */
.explanation-section h3 {
    font-size: 1.125rem;
    font-weight: 500;
    color: #111827;
    margin-bottom: 0.5rem;
}

.explanation-section p {
    color: #374151;
    line-height: 1.7;
}

/* Test Results */
.test-results {
    margin-top: 1rem;
}

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

.matches-count {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
}

.match-status {
    font-size: 0.75rem;
    color: #059669;
    background: #d1fae5;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
}

.highlighted-text {
    background: #f9fafb;
    border-radius: 0.75rem;
    padding: 1rem;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.5;
}

.highlighted-text mark {
    background: #fef3c7;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    color: #92400e;
}

.match-details {
    margin-top: 1rem;
}

.match-details h4 {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    margin-bottom: 0.5rem;
}

.match-item {
    font-size: 0.75rem;
    background: #dbeafe;
    padding: 0.5rem;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
}

.match-item .match-label {
    font-weight: 500;
}

.match-item .match-position {
    color: #6b7280;
    margin-left: 0.5rem;
}

/* Loading State */
.loading-card {
    text-align: center;
    padding: 3rem 1.5rem;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.loading-spinner {
    width: 2rem;
    height: 2rem;
    color: #3b82f6;
    animation: spin 1s linear infinite;
}

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

/* Error State */
.error-card {
    border-color: #fca5a5;
    background: rgba(254, 242, 242, 0.8);
}

.error-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #dc2626;
}

/* Getting Started */
.getting-started {
    text-align: center;
    padding: 2rem;
}

.welcome-icon {
    width: 4rem;
    height: 4rem;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: white;
}

.welcome-icon i {
    width: 2rem;
    height: 2rem;
}

.getting-started h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 1rem;
}

.getting-started > p {
    color: #6b7280;
    margin-bottom: 2rem;
    max-width: 28rem;
    margin-left: auto;
    margin-right: auto;
}

.features-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    max-width: 32rem;
    margin: 0 auto;
    text-align: left;
}

@media (min-width: 768px) {
    .features-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.feature-card {
    background: #f9fafb;
    padding: 1rem;
    border-radius: 0.75rem;
}

.feature-card h3 {
    font-weight: 500;
    color: #111827;
    margin-bottom: 0.5rem;
}

.feature-card ul {
    list-style: none;
    color: #6b7280;
    font-size: 0.875rem;
}

.feature-card li {
    margin-bottom: 0.25rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .matches-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* Animation for result section */
.result-section {
    animation: fadeInUp 0.5s ease-out;
}

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