/* Domain Search Extractor - Styles */

* {
    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: #333;
    background-color: #f5f5f5;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 20px 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    color: #2c3e50;
    font-size: 2.5rem;
    margin-bottom: 10px;
}

header p {
    color: #7f8c8d;
    font-size: 1.1rem;
}

/* Main Content */
main {
    flex: 1;
}

/* Input Section */
.input-section {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e8ed;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-btn {
    background: #3498db;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s ease;
    width: 100%;
}

.search-btn:hover {
    background: #2980b9;
}

.search-btn:active {
    transform: translateY(1px);
}

/* Error Messages */
.error-message {
    background: #e74c3c;
    color: white;
    padding: 16px 20px;
    border-radius: 8px;
    margin-top: 15px;
    font-weight: 500;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.2);
}

.error-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
    margin-top: 2px;
}

.error-content {
    flex: 1;
}

.error-message p {
    margin: 0;
    margin-bottom: 8px;
    line-height: 1.4;
}

.error-message p:last-child {
    margin-bottom: 0;
}

/* Error type specific styling */
.validation-error {
    background: #e67e22;
}

.network-error {
    background: #9b59b6;
}

.rate-limit-error {
    background: #f39c12;
}

.no-results-error {
    background: #34495e;
}

/* Error suggestions */
.error-suggestions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.3);
}

.error-suggestions p {
    margin-bottom: 8px;
    font-size: 0.9rem;
    opacity: 0.9;
}

.error-suggestions ul {
    margin: 0;
    padding-left: 20px;
    font-size: 0.9rem;
    opacity: 0.9;
}

.error-suggestions li {
    margin-bottom: 4px;
}

/* Form validation states */
.form-group input.invalid {
    border-color: #e74c3c;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.1);
}

.form-group input.valid {
    border-color: #27ae60;
    box-shadow: 0 0 0 3px rgba(39, 174, 96, 0.1);
}

/* Loading state for submit button */
.search-btn:disabled {
    background: #bdc3c7;
    cursor: not-allowed;
    transform: none;
}

.search-btn.loading {
    background: #3498db;
    cursor: wait;
    position: relative;
}

.search-btn.loading::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: translateY(-50%) rotate(0deg); }
    100% { transform: translateY(-50%) rotate(360deg); }
}

/* Loading Indicators */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    text-align: center;
    max-width: 300px;
}

.loading-spinner .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e1e8ed;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

.loading-spinner p {
    margin: 0;
    color: #2c3e50;
    font-weight: 500;
    font-size: 1.1rem;
}

.loading-spinner .loading-details {
    margin-top: 10px;
    font-size: 0.9rem;
    color: #7f8c8d;
}

/* Inline loading indicator for results */
.results-loading {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #e1e8ed;
}

.results-loading .spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #e1e8ed;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

.results-loading p {
    margin: 0;
    color: #7f8c8d;
    font-size: 1rem;
}

/* Output Section */
.output-section {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.output-section h2 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 1.8rem;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #ecf0f1;
}

.result-count {
    font-weight: 600;
    color: #27ae60;
    font-size: 1.1rem;
}

.results-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-again-btn,
.clear-btn {
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.search-again-btn {
    background: #3498db;
    color: white;
}

.search-again-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.clear-btn {
    background: #95a5a6;
    color: white;
}

.clear-btn:hover {
    background: #7f8c8d;
    transform: translateY(-1px);
}

/* Results Container */
.results-container {
    max-height: 500px;
    overflow-y: auto;
}

.results-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.url-item {
    padding: 20px;
    border: 1px solid #ecf0f1;
    border-radius: 8px;
    background: #fafbfc;
    transition: all 0.3s ease;
}

.url-item:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border-color: #3498db;
    background: #ffffff;
}

.url-header {
    margin-bottom: 8px;
}

.url-title {
    margin: 0;
    font-size: 1.1rem;
    line-height: 1.4;
}

.url-title a {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.url-title a:hover {
    color: #3498db;
    text-decoration: underline;
}

.secure-icon {
    font-size: 0.8rem;
    opacity: 0.7;
}

.url-details {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #7f8c8d;
}

.url-display {
    color: #27ae60;
    font-weight: 500;
}

.url-domain {
    color: #95a5a6;
    font-style: italic;
}

/* No results message */
.no-results {
    text-align: center;
    padding: 40px 20px;
    color: #7f8c8d;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #e1e8ed;
}

.no-results-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    opacity: 0.6;
}

.no-results h3 {
    color: #2c3e50;
    font-size: 1.4rem;
    margin-bottom: 15px;
    font-weight: 600;
}

.no-results p {
    margin-bottom: 15px;
    font-size: 1rem;
    line-height: 1.5;
}

.no-results strong {
    color: #2c3e50;
}

.no-results-suggestions {
    background: white;
    padding: 20px;
    border-radius: 6px;
    margin: 20px 0;
    text-align: left;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.no-results-suggestions p {
    margin-bottom: 10px;
    font-weight: 600;
    color: #2c3e50;
    text-align: center;
}

.no-results-suggestions ul {
    margin: 0;
    padding-left: 20px;
    color: #5a6c7d;
}

.no-results-suggestions li {
    margin-bottom: 8px;
    line-height: 1.4;
}

/* Footer */
footer {
    text-align: center;
    padding: 20px 0;
    color: #7f8c8d;
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    header p {
        font-size: 1rem;
    }
    
    .input-section,
    .output-section {
        padding: 20px;
    }
    
    .results-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .results-actions {
        width: 100%;
        justify-content: center;
    }
    
    .search-again-btn,
    .clear-btn {
        flex: 1;
        justify-content: center;
        padding: 10px 16px;
        font-size: 15px;
    }
    
    .url-item {
        padding: 15px;
    }
    
    .url-title {
        font-size: 1rem;
    }
    
    .url-details {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .error-message {
        padding: 12px 16px;
        font-size: 0.9rem;
    }
    
    .no-results-suggestions {
        padding: 15px;
        margin: 15px 0;
    }
    
    .loading-spinner {
        padding: 20px;
        max-width: 280px;
    }
    
    .loading-spinner .spinner {
        width: 35px;
        height: 35px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 10px;
    }
    
    header {
        margin-bottom: 20px;
        padding: 15px 0;
    }
    
    header h1 {
        font-size: 1.8rem;
        margin-bottom: 8px;
    }
    
    header p {
        font-size: 0.95rem;
    }
    
    .input-section,
    .output-section {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .form-group input {
        padding: 10px 14px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    .search-btn {
        padding: 12px 20px;
        font-size: 16px;
    }
    
    .output-section h2 {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }
    
    .results-header {
        gap: 12px;
    }
    
    .result-count {
        font-size: 1rem;
        text-align: center;
    }
    
    .search-again-btn,
    .clear-btn {
        padding: 8px 12px;
        font-size: 14px;
        gap: 4px;
    }
    
    .url-item {
        padding: 12px;
    }
    
    .url-title {
        font-size: 0.95rem;
        line-height: 1.3;
    }
    
    .url-details {
        font-size: 0.85rem;
        margin-top: 8px;
    }
    
    .no-results {
        padding: 30px 15px;
    }
    
    .no-results-icon {
        font-size: 2.5rem;
        margin-bottom: 15px;
    }
    
    .no-results h3 {
        font-size: 1.2rem;
        margin-bottom: 12px;
    }
    
    .no-results p {
        font-size: 0.9rem;
        margin-bottom: 12px;
    }
    
    .no-results-suggestions {
        padding: 12px;
        margin: 12px 0;
    }
    
    .error-message {
        padding: 10px 14px;
        font-size: 0.85rem;
        gap: 8px;
    }
    
    .error-icon {
        font-size: 1rem;
    }
    
    .loading-spinner {
        padding: 15px;
        max-width: 250px;
    }
    
    .loading-spinner .spinner {
        width: 30px;
        height: 30px;
        margin-bottom: 15px;
    }
    
    .loading-spinner p {
        font-size: 1rem;
    }
    
    .loading-spinner .loading-details {
        font-size: 0.85rem;
    }
}

/* High DPI / Retina Display Support */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .secure-icon,
    .error-icon,
    .no-results-icon {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Dark mode support (respects user preference) */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1a1a;
        color: #e1e1e1;
    }
    
    .container {
        background-color: #1a1a1a;
    }
    
    header,
    .input-section,
    .output-section {
        background: #2d2d2d;
        color: #e1e1e1;
    }
    
    header h1,
    .output-section h2,
    .form-group label {
        color: #ffffff;
    }
    
    header p {
        color: #b0b0b0;
    }
    
    .form-group input {
        background: #3a3a3a;
        border-color: #4a4a4a;
        color: #e1e1e1;
    }
    
    .form-group input:focus {
        border-color: #3498db;
        background: #404040;
    }
    
    .url-item {
        background: #3a3a3a;
        border-color: #4a4a4a;
    }
    
    .url-item:hover {
        background: #404040;
        border-color: #3498db;
    }
    
    .url-title a {
        color: #ffffff;
    }
    
    .url-title a:hover {
        color: #3498db;
    }
    
    .url-details {
        color: #b0b0b0;
    }
    
    .url-display {
        color: #27ae60;
    }
    
    .url-domain {
        color: #888888;
    }
    
    .no-results {
        background: #2a2a2a;
        border-color: #4a4a4a;
        color: #b0b0b0;
    }
    
    .no-results h3 {
        color: #ffffff;
    }
    
    .no-results-suggestions {
        background: #3a3a3a;
    }
    
    .loading-spinner {
        background: #2d2d2d;
        color: #e1e1e1;
    }
    
    .loading-spinner p {
        color: #ffffff;
    }
    
    .loading-spinner .loading-details {
        color: #b0b0b0;
    }
    
    .results-loading {
        background: #2a2a2a;
        border-color: #4a4a4a;
        color: #b0b0b0;
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .search-btn.loading::after {
        animation: none;
    }
    
    .loading-spinner .spinner,
    .results-loading .spinner {
        animation: none;
        border-top-color: #3498db;
    }
}

/* Focus indicators for better accessibility */
.search-again-btn:focus,
.clear-btn:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.url-title a:focus {
    outline: 2px solid #3498db;
    outline-offset: 2px;
    border-radius: 2px;
}

/* Print styles */
@media print {
    body {
        background: white;
        color: black;
    }
    
    .container {
        max-width: none;
        padding: 0;
        box-shadow: none;
    }
    
    header,
    .input-section,
    .output-section {
        background: white;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .search-btn,
    .search-again-btn,
    .clear-btn,
    .results-actions {
        display: none;
    }
    
    .url-title a {
        color: black;
        text-decoration: underline;
    }
    
    .url-title a::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
    
    .error-message {
        border: 1px solid #ccc;
        background: #f5f5f5;
        color: black;
    }
}