/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 100vh;
    color: #2d3748;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.main-header {
    background: white;
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 30px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.logo-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #E60023 0%, #BD001B 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
    box-shadow: 0 10px 20px rgba(230, 0, 35, 0.2);
}

.logo-text h1 {
    font-size: 2.5rem;
    background: linear-gradient(135deg, #E60023 0%, #BD001B 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 5px;
}

.tagline {
    color: #718096;
    font-size: 1.1rem;
}

.header-stats {
    display: flex;
    gap: 30px;
}

.stat {
    text-align: center;
    padding: 15px 25px;
    background: #f7fafc;
    border-radius: 15px;
    border: 2px solid #e2e8f0;
}

.stat i {
    font-size: 1.8rem;
    color: #E60023;
    margin-bottom: 10px;
    display: block;
}

.stat-number {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: #2d3748;
    line-height: 1;
}

.stat-label {
    font-size: 0.9rem;
    color: #718096;
    display: block;
    margin-top: 5px;
}

/* Download Card */
.download-section {
    margin-bottom: 30px;
}

.download-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.card-header {
    text-align: center;
    margin-bottom: 40px;
}

.card-header h2 {
    font-size: 2.2rem;
    color: #2d3748;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.subtitle {
    color: #718096;
    font-size: 1.2rem;
}

/* URL Input */
.url-input-container {
    margin-bottom: 40px;
}

.input-group {
    display: flex;
    background: #f7fafc;
    border-radius: 15px;
    border: 3px solid #e2e8f0;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.input-group:focus-within {
    border-color: #E60023;
    box-shadow: 0 0 0 4px rgba(230, 0, 35, 0.1);
    background: white;
}

.input-prepend {
    padding: 0 25px;
    display: flex;
    align-items: center;
    color: #E60023;
    font-size: 1.3rem;
    border-right: 2px solid #e2e8f0;
}

#pinterestUrl {
    flex: 1;
    padding: 22px 20px;
    border: none;
    background: transparent;
    font-size: 1.1rem;
    font-family: 'Inter', sans-serif;
    color: #2d3748;
    outline: none;
}

#pinterestUrl::placeholder {
    color: #a0aec0;
}

.input-append {
    display: flex;
    padding: 0 15px;
    gap: 10px;
    align-items: center;
}

.btn-icon {
    width: 45px;
    height: 45px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    color: #718096;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.btn-icon:hover {
    background: #E60023;
    border-color: #E60023;
    color: white;
    transform: translateY(-2px);
}

/* API Selector */
.api-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    background: #edf2f7;
    padding: 15px 20px;
    border-radius: 12px;
}

.api-selector label {
    color: #4a5568;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

#apiSelect {
    flex: 1;
    padding: 12px 20px;
    border: 2px solid #cbd5e0;
    border-radius: 10px;
    background: white;
    color: #2d3748;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}

#apiSelect:focus {
    border-color: #E60023;
    box-shadow: 0 0 0 3px rgba(230, 0, 35, 0.1);
}

/* Main Download Button */
.btn-download-main {
    width: 100%;
    padding: 22px;
    background: linear-gradient(135deg, #E60023 0%, #BD001B 100%);
    border: none;
    border-radius: 15px;
    color: white;
    font-size: 1.3rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    margin-bottom: 25px;
    box-shadow: 0 10px 25px rgba(230, 0, 35, 0.25);
}

.btn-download-main:hover:not(.loading) {
    transform: translateY(-3px);
    box-shadow: 0 20px 40px rgba(230, 0, 35, 0.35);
}

.btn-download-main:active:not(.loading) {
    transform: translateY(-1px);
}

.btn-text, .btn-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    transition: opacity 0.3s ease;
}

.btn-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

.btn-download-main.loading .btn-text {
    opacity: 0;
}

.btn-download-main.loading .btn-loader {
    opacity: 1;
}

/* Quick Links */
.quick-links {
    background: #e6fffa;
    padding: 20px;
    border-radius: 15px;
    border: 2px solid #b2f5ea;
}

.quick-title {
    color: #234e52;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
}

.link-buttons {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.link-btn {
    padding: 12px 24px;
    background: white;
    border: 2px solid #38b2ac;
    border-radius: 10px;
    color: #285e61;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Inter', sans-serif;
}

.link-btn:hover {
    background: #38b2ac;
    color: white;
    transform: translateY(-2px);
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    padding-top: 40px;
    border-top: 2px solid #e2e8f0;
}

.feature {
    display: flex;
    align-items: center;
    gap: 20px;
}

.feature-icon {
    width: 60px;
    height: 60px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.feature-icon.success {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.feature-icon.warning {
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    color: white;
}

.feature-icon.info {
    background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
    color: white;
}

.feature-icon.danger {
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    color: white;
}

.feature-content h4 {
    color: #2d3748;
    margin-bottom: 5px;
    font-size: 1.2rem;
}

.feature-content p {
    color: #718096;
    font-size: 0.95rem;
}

/* Results Section */
.results-section {
    background: white;
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e2e8f0;
}

.section-header h3 {
    font-size: 1.8rem;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 15px;
}

.results-info {
    display: flex;
    gap: 20px;
    align-items: center;
}

.results-count {
    background: #edf2f7;
    padding: 8px 20px;
    border-radius: 50px;
    font-weight: 600;
    color: #2d3748;
}

.server-status {
    background: #c6f6d5;
    color: #22543d;
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.server-status i {
    color: #38a169;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Loading State */
.loading-container {
    padding: 60px 20px;
    text-align: center;
    display: none;
}

.pulse-loader {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 30px;
}

.pulse-circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #E60023;
    opacity: 0;
    animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

.pulse-circle:nth-child(2) { animation-delay: 0.3s; }
.pulse-circle:nth-child(3) { animation-delay: 0.6s; }

@keyframes pulse-ring {
    0% {
        transform: scale(0.33);
        opacity: 1;
    }
    80%, 100% {
        transform: scale(1);
        opacity: 0;
    }
}

.loading-content h4 {
    color: #2d3748;
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.loading-text {
    color: #718096;
    margin-bottom: 25px;
    font-size: 1.1rem;
}

.progress-container {
    width: 100%;
    max-width: 400px;
    height: 10px;
    background: #e2e8f0;
    border-radius: 5px;
    margin: 0 auto 20px;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #E60023 0%, #BD001B 100%);
    border-radius: 5px;
    transition: width 0.3s ease;
}

.server-tries {
    color: #718096;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

/* Error State */
.error-container {
    padding: 40px;
    text-align: center;
    display: none;
}

.error-content {
    max-width: 600px;
    margin: 0 auto;
}

.error-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #f56565 0%, #e53e3e 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
    margin: 0 auto 25px;
}

#errorTitle {
    color: #2d3748;
    font-size: 1.8rem;
    margin-bottom: 15px;
}

#errorMessage {
    color: #718096;
    font-size: 1.1rem;
    margin-bottom: 25px;
    line-height: 1.6;
}

.error-solutions {
    background: #fff5f5;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 30px;
    text-align: left;
    border: 2px solid #fed7d7;
}

.error-solutions p {
    color: #742a2a;
    margin-bottom: 15px;
    font-weight: 600;
}

.error-solutions ul {
    list-style: none;
}

.error-solutions li {
    color: #742a2a;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.error-solutions li i {
    color: #38a169;
}

.error-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-retry {
    padding: 15px 35px;
    background: linear-gradient(135deg, #E60023 0%, #BD001B 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.btn-retry:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(230, 0, 35, 0.25);
}

.btn-secondary {
    padding: 15px 35px;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    color: #4a5568;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

/* Media Container */
.media-container {
    display: none;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 25px;
}

.media-card {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.media-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12);
}

.media-header {
    position: relative;
    height: 200px;
    overflow: hidden;
}

.media-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.media-card:hover .media-thumbnail {
    transform: scale(1.05);
}

.media-type {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.media-body {
    padding: 25px;
}

.media-title {
    font-size: 1.2rem;
    color: #2d3748;
    margin-bottom: 15px;
    font-weight: 600;
    line-height: 1.4;
}

.media-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e2e8f0;
}

.media-size {
    color: #718096;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

.media-quality {
    background: #bee3f8;
    color: #2c5282;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: 600;
}

.media-actions {
    display: flex;
    gap: 15px;
}

.btn-download-media {
    flex: 1;
    padding: 15px;
    background: linear-gradient(135deg, #E60023 0%, #BD001B 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.btn-download-media:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(230, 0, 35, 0.2);
}

.btn-preview {
    width: 50px;
    padding: 15px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    color: #718096;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-preview:hover {
    background: #E60023;
    border-color: #E60023;
    color: white;
}

/* Empty State */
.empty-container {
    padding: 80px 20px;
    text-align: center;
}

.empty-content {
    max-width: 600px;
    margin: 0 auto;
}

.empty-icon {
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #f7fafc 0%, #edf2f7 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #cbd5e0;
    font-size: 3rem;
    margin: 0 auto 30px;
}

.empty-content h4 {
    color: #2d3748;
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.empty-content p {
    color: #718096;
    font-size: 1.1rem;
    margin-bottom: 30px;
}

.empty-tips {
    background: #f7fafc;
    border-radius: 15px;
    padding: 25px;
    text-align: left;
}

.tip {
    color: #4a5568;
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.tip:last-child {
    margin-bottom: 0;
}

.tip i {
    color: #E60023;
    margin-top: 3px;
}

/* Instructions */
.instructions-section {
    background: white;
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

.steps-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 40px;
    margin-top: 40px;
}

.step {
    display: flex;
    gap: 25px;
    align-items: flex-start;
}

.step-number {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #E60023 0%, #BD001B 100%);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.8rem;
    font-weight: 700;
    flex-shrink: 0;
}

.step-content h4 {
    color: #2d3748;
    font-size: 1.4rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.step-content p {
    color: #718096;
    line-height: 1.7;
}

/* FAQ */
.faq-section {
    background: white;
    border-radius: 20px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

.faq-container {
    margin-top: 40px;
}

.faq-item {
    border: 2px solid #e2e8f0;
    border-radius: 15px;
    margin-bottom: 20px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-item.active {
    border-color: #E60023;
    box-shadow: 0 5px 15px rgba(230, 0, 35, 0.1);
}

.faq-question {
    padding: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: #f7fafc;
}

.faq-question h4 {
    color: #2d3748;
    font-size: 1.2rem;
    font-weight: 600;
}

.faq-question i {
    color: #718096;
    transition: transform 0.3s ease;
}

.faq-item.active .faq-question i {
    transform: rotate(180deg);
    color: #E60023;
}

.faq-answer {
    padding: 0 25px;
    max-height: 0;
    overflow: hidden;
    transition: all 0.3s ease;
}

.faq-item.active .faq-answer {
    padding: 0 25px 25px;
    max-height: 200px;
}

.faq-answer p {
    color: #718096;
    line-height: 1.7;
}

/* Footer */
.main-footer {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.1);
}

.footer-content {
    text-align: center;
}

.footer-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    color: #E60023;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 25px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #718096;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #E60023;
}

.footer-disclaimer {
    color: #a0aec0;
    font-size: 0.9rem;
    padding-top: 25px;
    border-top: 2px solid #e2e8f0;
}

.footer-disclaimer i {
    color: #718096;
    margin-right: 8px;
}

/* Toast Notification */
.toast-container {
    position: fixed;
    top: 30px;
    right: 30px;
    z-index: 9999;
}

.toast {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border-left: 5px solid #E60023;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    max-width: 400px;
    transform: translateX(400px);
    transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-left-color: #38a169;
}

.toast.error {
    border-left-color: #e53e3e;
}

.toast.warning {
    border-left-color: #d69e2e;
}

.toast-icon {
    font-size: 1.5rem;
    margin-top: 2px;
}

.toast.success .toast-icon {
    color: #38a169;
}

.toast.error .toast-icon {
    color: #e53e3e;
}

.toast.warning .toast-icon {
    color: #d69e2e;
}

.toast-content h4 {
    color: #2d3748;
    margin-bottom: 5px;
    font-size: 1.1rem;
}

.toast-content p {
    color: #718096;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }

    .main-header {
        flex-direction: column;
        text-align: center;
        padding: 25px;
    }

    .logo-container {
        flex-direction: column;
    }

    .header-stats {
        flex-direction: column;
        gap: 20px;
    }

    .download-card {
        padding: 25px;
    }

    .input-group {
        flex-direction: column;
        background: white;
        border: 2px solid #e2e8f0;
    }

    .input-prepend {
        border-right: none;
        border-bottom: 2px solid #e2e8f0;
        padding: 15px;
        justify-content: center;
    }

    .input-append {
        padding: 15px;
        justify-content: center;
        border-top: 2px solid #e2e8f0;
    }

    .api-selector {
        flex-direction: column;
        align-items: stretch;
    }

    .section-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .results-info {
        flex-direction: column;
        gap: 10px;
    }

    .media-grid {
        grid-template-columns: 1fr;
    }

    .steps-container {
        grid-template-columns: 1fr;
        gap: 30px;
    }

    .step {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .footer-links {
        flex-direction: column;
        gap: 15px;
    }

    .toast {
        left: 20px;
        right: 20px;
        max-width: none;
    }
}