/* ============================================
   Pinterest Downloader - Modern Styling
   Dark mode support with light mode default
   ============================================ */

/* CSS Variables - Light Mode (Default) */
:root {
    --transition-speed: 0.25s;
    
    /* Primary Colors - Pinterest-inspired */
    --primary: #E60023;
    --primary-light: #FFEAEE;
    --primary-dark: #C7001F;
    --accent: #FF5C7C;
    
    /* Status Colors */
    --success: #10B981;
    --success-light: #D1FAE5;
    --warning: #F59E0B;
    --warning-light: #FEF3C7;
    --danger: #EF4444;
    --danger-light: #FEE2E2;
    --info: #3B82F6;
    --info-light: #DBEAFE;
    
    /* Type Colors */
    --video-color: #3399cc;
    --image-color: #339966;
    --gif-color: #e64e4e;
    
    /* Background Colors */
    --bg: #F8FAFC;
    --bg-elevated: #FFFFFF;
    --bg-secondary: #F1F5F9;
    --bg-tertiary: #E2E8F0;
    
    /* Text Colors */
    --text: #1E293B;
    --text-secondary: #475569;
    --text-muted: #64748B;
    
    /* Border Colors */
    --border: #E2E8F0;
    --border-light: #F1F5F9;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
    --shadow-primary: 0 4px 14px rgba(230, 0, 35, 0.2);
    --shadow-primary-hover: 0 6px 20px rgba(230, 0, 35, 0.3);
    
    /* Radius */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Input */
    --input-bg: #FFFFFF;
    --input-border: #E2E8F0;
}

/* Dark Mode Colors */
[data-theme="dark"] {
    --primary: #FF5C7C;
    --primary-light: rgba(255, 92, 124, 0.15);
    --primary-dark: #E60023;
    --accent: #FF8A9E;
    
    --success: #4ADE80;
    --success-light: rgba(74, 222, 128, 0.15);
    --warning: #FBBF24;
    --warning-light: rgba(251, 191, 36, 0.15);
    --danger: #F87171;
    --danger-light: rgba(248, 113, 113, 0.15);
    --info: #60A5FA;
    --info-light: rgba(96, 165, 250, 0.15);
    
    --video-color: #60B5F0;
    --image-color: #5EC990;
    --gif-color: #FF7B7B;
    
    --bg: #0F172A;
    --bg-elevated: #1E293B;
    --bg-secondary: #334155;
    --bg-tertiary: #475569;
    
    --text: #F1F5F9;
    --text-secondary: #CBD5E1;
    --text-muted: #94A3B8;
    
    --border: #334155;
    --border-light: #1E293B;
    
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.4);
    --shadow-primary: 0 4px 14px rgba(255, 92, 124, 0.15);
    --shadow-primary-hover: 0 6px 20px rgba(255, 92, 124, 0.25);
    
    --input-bg: #1E293B;
    --input-border: #475569;
}

/* ============================================
   BASE & LAYOUT
   ============================================ */

.tool-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

/* ============================================
   TOOL HEADER
   ============================================ */

.tool-header {
    text-align: center;
    margin-bottom: 32px;
}

.tool-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 12px;
}

.tool-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    flex-shrink: 0;
}

.tool-icon-wrapper svg,
.tool-icon-wrapper i {
    width: 26px;
    height: 26px;
}

.tool-title {
    font-size: 28px;
    font-weight: 800;
    color: var(--text);
    margin: 0;
    letter-spacing: -0.5px;
}

.tool-description {
    max-width: 800px;
    margin: 0 auto;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* ============================================
   URL INPUT SECTION
   ============================================ */

.url-section {
    margin-bottom: 24px;
}

.url-input-area {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.url-input-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    border-radius: var(--radius-md);
    padding: 0 16px;
    transition: all var(--transition-speed) ease;
    min-height: 56px;
}

.url-input-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: var(--shadow-primary);
}

.url-input-icon {
    color: var(--text-muted);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    margin-right: 12px;
}

.url-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 15px;
    color: var(--text);
    outline: none;
    min-width: 0;
    font-family: inherit;
}

.url-input::placeholder {
    color: var(--text-muted);
    font-size: 14px;
}

.paste-btn,
.clear-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
    transition: all var(--transition-speed) ease;
}

.paste-btn:hover,
.clear-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text);
}

.fetch-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 28px;
    min-height: 56px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.fetch-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    box-shadow: var(--shadow-primary-hover);
    transform: translateY(-1px);
}

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

.fetch-btn.loading {
    pointer-events: none;
}

.url-hints {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.url-hint {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: var(--text-muted);
}

.url-hint svg {
    color: var(--success);
}

/* ============================================
   LOADING SECTION
   ============================================ */

.loading-section {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 60px 20px;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 16px;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 6px;
}

.loading-subtext {
    font-size: 13px;
    color: var(--text-muted);
    margin: 0;
}

/* ============================================
   RESULTS SECTION
   ============================================ */

.results-section {
    animation: fadeInUp 0.4s ease;
}

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

/* Pin Info Card */
.pin-info {
    display: flex;
    gap: 24px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.pin-preview-area {
    flex-shrink: 0;
    width: 200px;
}

.pin-preview {
    width: 200px;
    max-height: 280px;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-media {
    width: 100%;
    height: auto;
    max-height: 280px;
    object-fit: contain;
    display: block;
    border-radius: var(--radius-md);
}

.preview-video {
    width: 200px;
    max-height: 280px;
    background: #000;
}

.pin-details {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pin-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    width: fit-content;
}

.pin-type-badge.type-video {
    background: rgba(51, 153, 204, 0.1);
    color: var(--video-color);
}

.pin-type-badge.type-image {
    background: rgba(51, 153, 102, 0.1);
    color: var(--image-color);
}

.pin-type-badge.type-gif {
    background: rgba(230, 78, 78, 0.1);
    color: var(--gif-color);
}

.pin-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pin-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.pin-meta {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: auto;
}

.pin-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text-muted);
}

/* ============================================
   DOWNLOAD OPTIONS
   ============================================ */

.download-options {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.download-heading {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 16px;
}

.download-heading svg {
    color: var(--primary);
}

.download-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.download-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-speed) ease;
}

.download-item:hover {
    background: var(--bg-tertiary);
}

.download-item.download-primary {
    background: var(--primary-light);
}

.download-item.download-primary:hover {
    background: var(--primary-light);
    box-shadow: var(--shadow-sm);
}

.download-item-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.download-item-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.download-primary .download-item-icon {
    background: var(--bg-elevated);
    color: var(--primary);
}

.download-item-details {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.download-item-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.download-item-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.format-badge {
    display: inline-flex;
    padding: 1px 6px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.download-primary .format-badge {
    background: rgba(230, 0, 35, 0.1);
    color: var(--primary);
}

.size-info {
    font-size: 12px;
    color: var(--text-muted);
}

.download-item-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-speed) ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-download {
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-download:hover {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: var(--shadow-primary);
}

.btn-download-primary {
    background: var(--primary);
    color: #fff;
    border: 1px solid var(--primary);
}

.btn-download-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: var(--shadow-primary-hover);
    transform: translateY(-1px);
}

/* ============================================
   RESULTS ACTIONS
   ============================================ */

.results-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 32px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    border: none;
    text-decoration: none;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    box-shadow: var(--shadow-sm);
}

/* ============================================
   ERROR MESSAGE
   ============================================ */

.error-message {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 20px;
    background: var(--danger-light);
    border-radius: var(--radius-md);
    margin-top: 16px;
    animation: fadeInUp 0.3s ease;
}

.error-content {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    flex: 1;
}

.error-content > svg,
.error-content > i {
    color: var(--danger);
    flex-shrink: 0;
    margin-top: 1px;
}

.error-text-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.error-text {
    font-size: 14px;
    font-weight: 600;
    color: var(--danger);
}

.error-help {
    font-size: 13px;
    color: var(--text-secondary);
}

.error-help a {
    color: var(--primary);
    text-decoration: underline;
}

.error-dismiss {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--danger);
    cursor: pointer;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    opacity: 0.6;
    transition: all var(--transition-speed) ease;
}

.error-dismiss:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.1);
}

/* ============================================
   RELATED TOOLS
   ============================================ */

.related-tools {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 20px;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.related-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.related-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.related-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-speed) ease;
}

.related-link:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* ============================================
   INFO SECTIONS
   ============================================ */

.info-sections {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.info-card {
    padding: 0;
}

.info-card h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 16px;
}

.info-card h2 svg,
.info-card h2 i {
    color: var(--primary);
    flex-shrink: 0;
}

.info-card p {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin: 0 0 12px;
}

.info-card p:last-child {
    margin-bottom: 0;
}

.info-card a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.info-card a:hover {
    text-decoration: underline;
}

/* Steps List */
.steps-list {
    margin: 0;
    padding: 0 0 0 24px;
    counter-reset: step;
}

.steps-list li {
    font-size: 15px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin-bottom: 8px;
    padding-left: 4px;
}

.steps-list li:last-child {
    margin-bottom: 0;
}

/* Mode Explanations */
.mode-explanations {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mode-explain {
    padding: 0;
}

.mode-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.mode-tag.tag-video {
    background: rgba(51, 153, 204, 0.1);
    color: var(--video-color);
}

.mode-tag.tag-image {
    background: rgba(51, 153, 102, 0.1);
    color: var(--image-color);
}

.mode-tag.tag-gif {
    background: rgba(230, 78, 78, 0.1);
    color: var(--gif-color);
}

.mode-explain p {
    font-size: 14px;
    margin: 6px 0 0;
}

/* ============================================
   FAQ SECTION
   ============================================ */

.faq-card {
    padding: 0;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-speed) ease;
}

.faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 20px;
    background: var(--bg-elevated);
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    text-align: left;
    transition: all var(--transition-speed) ease;
    font-family: inherit;
}

.faq-question:hover {
    background: var(--bg-secondary);
}

.faq-question svg,
.faq-question i {
    color: var(--text-muted);
    transition: transform var(--transition-speed) ease;
    flex-shrink: 0;
    margin-left: 12px;
}

.faq-item.active .faq-question svg,
.faq-item.active .faq-question i {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-item.active .faq-answer {
    max-height: 500px;
}

.faq-answer p {
    padding: 0 20px 16px;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

.faq-answer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.faq-answer a:hover {
    text-decoration: underline;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .tool-container {
        padding: 16px 14px 32px;
    }
    
    .tool-title {
        font-size: 22px;
    }
    
    .tool-description {
        font-size: 14px;
    }
    
    .url-input-area {
        flex-direction: column;
    }
    
    .url-input-wrapper {
        min-height: 50px;
    }
    
    .fetch-btn {
        min-height: 50px;
        justify-content: center;
    }
    
    .pin-info {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .pin-preview-area {
        width: 100%;
        max-width: 280px;
    }
    
    .pin-preview {
        width: 100%;
    }
    
    .preview-video {
        width: 100%;
    }
    
    .pin-details {
        align-items: center;
    }
    
    .pin-meta {
        justify-content: center;
    }
    
    .download-item {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .download-item-btn {
        justify-content: center;
        padding: 10px 18px;
    }
    
    .related-tools {
        flex-direction: column;
        gap: 10px;
    }
    
    .related-links {
        gap: 6px;
    }
    
    .url-hints {
        gap: 10px;
    }
    
    .info-card h2 {
        font-size: 18px;
    }
}

@media (max-width: 480px) {
    .tool-title-row {
        gap: 10px;
    }
    
    .tool-icon-wrapper {
        width: 40px;
        height: 40px;
    }
    
    .tool-title {
        font-size: 20px;
    }
    
    .pin-title {
        font-size: 16px;
    }
    
    .faq-question {
        font-size: 14px;
        padding: 14px 16px;
    }
}

/* ============================================
   REDUCED MOTION
   ============================================ */

@media (prefers-reduced-motion) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
    
    .loading-spinner {
        animation: spin 2s linear infinite;
    }
}
