/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Roboto, Oxygen, Cantarell, sans-serif;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0e7ff 100%);
    min-height: 100vh;
    color: #1f2937;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Container and Layout */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem;
}

.main-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.input-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

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

.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    position: relative;
}

.header-content .theme-toggle {
    position: absolute;
    right: 0;
}

.header h1 {
    font-size: 2rem;
    font-weight: bold;
    color: #1f2937;
    margin: 0.5rem 0;
}

.header-description {
    font-size: 1rem;
    color: #6b7280;
    max-width: 56rem;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Theme Toggle */
.theme-toggle {
    background: #374151;
    color: white;
    border: none;
    border-radius: 50%;
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-toggle:hover {
    background: #4b5563;
    transform: scale(1.05);
}

.theme-icon {
    width: 1.25rem;
    height: 1.25rem;
}

/* Icon Styles */
.header-icon, .btn-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.tab-icon {
    width: 0.875rem;
    height: 0.875rem;
    margin-right: 0.5rem;
}

.close-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* Card Styles */
.card {
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.card-header {
    padding: 1rem 1rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.1rem;
}

.card-header .action-buttons {
    margin-left: auto;
    justify-content: flex-end;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    display: flex;
}

.inline-flex {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.card-header h2 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
}

.dark .header .header-description {
    color: #cbd5e1;
}

.dark .card-header h2 {
    color: #f1f5f9;
}

.dark h1 {
    color: #f1f5f9;
}

.dark .card-content .form-group label {
    color: #f1f5f9;
}

.dark .help-text {
    color: #9ca3af;
}

.card-content {
    padding: 1rem;
}

/* Button Styles */
.fetch-btn, .view-code-btn, .copy-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.fetch-btn {
    background: #3b82f6;
    color: white;
    padding: 0.75rem 1rem;
    width: 100%;
}

.fetch-btn:hover {
    background: #2563eb;
}

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

.view-code-btn {
    background: #4f46e5;
    color: white;
    padding: 8px 16px;
    font-size: 14px;
}

.view-code-btn:hover {
    background: #4338ca;
    transform: translateY(-1px);
}

.copy-btn {
    background: #10b981;
    color: white;
    padding: 10px 20px;
    font-size: 14px;
    width: 100%;
}

.copy-btn:hover {
    background: #059669;
    transform: translateY(-1px);
}

/* Form Styles */
.url-input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.url-input, .form-input, .form-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.375rem;
    font-size: 1rem;
}

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

.form-textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group:last-child {
    margin-bottom: 0;
}

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

.help-text {
    font-size: 0.875rem;
    color: #6b7280;
    line-height: 1.4;
}

/* Enrichment Fields */
.enrichment-fields {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
}

.enrichment-title {
    font-size: 1rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e2e8f0;
}

/* Tab Styles */
.tabs {
    width: 100%;
}

.tab-list {
    display: flex;
    background: #f3f4f6;
    border-radius: 0.375rem;
    padding: 0.25rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.tab-button {
    flex: 1;
    min-width: fit-content;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s;
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-button.active {
    background: white;
    color: #1f2937;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Social Media Preview Styles */
.twitter-preview, .facebook-preview, .linkedin-preview, .instagram-preview {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    overflow: hidden;
    max-width: 100%;
    margin: 0 auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.twitter-header, .facebook-header, .linkedin-header, .instagram-header {
    padding: 0.75rem;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.twitter-avatar, .facebook-avatar, .linkedin-avatar, .instagram-avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.twitter-avatar { background: #3b82f6; }
.facebook-avatar { background: #1877f2; }
.linkedin-avatar { background: #0a66c2; }
.instagram-avatar { background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%); }

/* Card Preview Styles */
.twitter-card, .facebook-card, .linkedin-card {
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
}

.twitter-card-image, .facebook-card-image, .linkedin-card-image {
    aspect-ratio: 16/9;
    background: #f3f4f6;
    overflow: hidden;
}

.twitter-card-image img, .facebook-card-image img, .linkedin-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Modern Footer Styles */
.footer {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: #e2e8f0;
    margin-top: 3rem;
    padding: 3rem 0 1rem;
    border-top: 1px solid #475569;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-section h3 {
    color: #f1f5f9;
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.footer-section h4 {
    color: #cbd5e1;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.footer-section p {
    color: #94a3b8;
    font-size: 0.875rem;
    line-height: 1.5;
}

.footer-links {
    list-style: none;
    padding: 0;
}

.footer-links li {
    margin-bottom: 0.5rem;
}

.footer-links a {
    color: #94a3b8;
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: #e2e8f0;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    width: 2.5rem;
    height: 2.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.social-links a:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.social-links svg {
    width: 1.25rem;
    height: 1.25rem;
    color: #e2e8f0;
}

.footer-bottom {
    grid-column: 1 / -1;
    text-align: center;
    padding-top: 2rem;
    margin-top: 2rem;
    border-top: 1px solid #475569;
}

.footer-bottom p {
    color: #94a3b8;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
}

/* Utility Classes */
.spinner {
    animation: spin 1s linear infinite;
}

.spinner.hidden, .hidden {
    display: none;
}

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

/* Modal Styles */
.modal {
    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: 1;
    transition: opacity 0.3s ease;
    padding: 1rem;
}

.modal.hidden {
    opacity: 0;
    pointer-events: none;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal:not(.hidden) .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
}

.close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #6b7280;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: #f3f4f6;
    color: #374151;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(80vh - 80px);
}

.modal-description {
    margin: 0 0 16px 0;
    color: #6b7280;
    font-size: 14px;
}

.code-output {
    background: #1f2937;
    color: #f9fafb;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.5;
    overflow-x: auto;
    white-space: pre;
    margin: 0 0 16px 0;
    border: 1px solid #374151;
    word-wrap: break-word;
}

/* Toast Styles */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: #1f2937;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transform: translateY(0);
    transition: transform 0.3s ease;
    max-width: calc(100vw - 4rem);
    word-wrap: break-word;
}

.toast.hidden {
    transform: translateY(100px);
}

.toast.error {
    background: #dc2626;
}

.toast.success {
    background: #16a34a;
}

/* Dark Mode */
.dark {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #f1f5f9;
}

.dark .theme-toggle {
    background: #d1d5db;
    color: #1f2937;
}

.dark .theme-toggle:hover {
    background: #e5e7eb;
}

.dark .card {
    background: #1e293b;
    border: 1px solid #334155;
    color: #f1f5f9;
}

.dark .url-input, .dark .form-input, .dark .form-textarea {
    background: #334155;
    border: 1px solid #475569;
    color: #f1f5f9;
}

.dark .enrichment-fields {
    background: #0f172a;
    border: 1px solid #334155;
}

.dark .footer {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    border-top: 1px solid #334155;
}

/* Dark Mode Icon Updates */
.dark .theme-toggle {
    background: #d1d5db;
    color: #1f2937;
}

.dark .theme-toggle:hover {
    background: #e5e7eb;
}

.dark .close-btn:hover {
    background: #374151;
    color: #e5e7eb;
}

.dark .tab-button.active {
    background: #374151;
    color: #f1f5f9;
}

/* Dark Mode Social Media Previews */
.dark .twitter-preview, .dark .facebook-preview, .dark .linkedin-preview, .dark .instagram-preview {
    background: #1e293b;
    border: 1px solid #334155;
    color: #f1f5f9;
}

.dark .twitter-header, .dark .facebook-header, .dark .linkedin-header, .dark .instagram-header {
    border-bottom: 1px solid #334155;
    color: #f1f5f9;
}

.dark .twitter-card, .dark .facebook-card, .dark .linkedin-card {
    border: 1px solid #334155;
    background: #0f172a;
}

.dark .twitter-card-image, .dark .facebook-card-image, .dark .linkedin-card-image {
    background: #334155;
}

/* Dark Mode Social Preview Text Colors */
.dark .twitter-preview h3,
.dark .twitter-preview p,
.dark .twitter-preview div {
    color: #f1f5f9 !important;
}

.dark .facebook-preview h3,
.dark .facebook-preview p,
.dark .facebook-preview div {
    color: #f1f5f9 !important;
}

.dark .linkedin-preview h3,
.dark .linkedin-preview p,
.dark .linkedin-preview div {
    color: #f1f5f9 !important;
}

.dark .instagram-preview h3,
.dark .instagram-preview p,
.dark .instagram-preview div {
    color: #f1f5f9 !important;
}

/* Dark Mode Social Preview Card Content */
.dark .twitter-card div,
.dark .facebook-card div,
.dark .linkedin-card div {
    background: #0f172a !important;
}

/* Dark Mode Domain and Description Text */
.dark #twitterDomain,
.dark #facebookDomain,
.dark #linkedinDomain,
.dark #instagramDomain,
.dark #pinterestDomain {
    color: #94a3b8 !important;
}

.dark #twitterDescription,
.dark #facebookDescription,
.dark #linkedinDescription,
.dark #instagramDescription,
.dark #pinterestDescription {
    color: #cbd5e1 !important;
}

.dark #twitterTitle,
.dark #facebookTitle,
.dark #linkedinTitle,
.dark #instagramTitle,
.dark #pinterestTitle {
    color: #f1f5f9 !important;
}

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

    .header h1 {
        font-size: 1.75rem;
    }

    .url-input-group {
        gap: 0.75rem;
    }

    .tab-button {
        min-width: calc(50% - 0.125rem);
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .social-links {
        justify-content: center;
    }

    .card-header .action-buttons {
        display: inline-flex;
        flex-direction: row;
        align-items: center;
        gap: 0.5rem;
        row-gap: 0.5rem;
    }

    .view-code-btn {
        width: auto;
        min-width: 100%;
        margin-bottom: 0.5rem;
    }
}

@media (min-width: 769px) and (max-width: 1023px) {
    .url-input-group {
        flex-direction: row;
    }

    .fetch-btn {
        width: auto;
        min-width: 100px;
    }
}

@media (min-width: 1024px) {
    .main-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }

    .header h1 {
        font-size: 2.5rem;
    }

    .url-input-group {
        flex-direction: row;
    }

    .fetch-btn {
        width: auto;
        min-width: 100px;
    }
}