/* 
  Project: YouTube Tags Extractor
  Author: imsabbar
  Description: Modern, glassmorphic UI design system.
*/

/* Import Google Font - Poppins */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

:root {
    /* Brand Colors */
    --primary-color: #6c5ce7;
    --primary-hover: #5649c0;
    --background-gradient: linear-gradient(135deg, #6c5ce7, #a29bfe);
    
    /* Surface & Text */
    --surface-color: #ffffff;
    --text-color: #2d3436;
    --text-light: #636e72;
    --border-color: #dfe6e9;
    
    /* Effects */
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.95);
    --radius: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: var(--background-gradient);
    padding: 20px;
}

::selection {
    color: #fff;
    background: var(--primary-color);
}

.wrapper {
    width: 100%;
    max-width: 900px;
    background: var(--glass-bg);
    border-radius: var(--radius);
    padding: 25px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: transform 0.3s ease;
}

/* Results Grid Layout */
.results-grid {
    display: grid;
    grid-template-columns: 0.9fr 1.1fr;
    gap: 30px;
    margin-top: 10px;
    align-items: start;
}

@media (max-width: 850px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
}

.wrapper :where(.title, li, .details) {
    display: flex;
    align-items: center;
}

/* Enhanced Tags Header */
.tags-header {
    margin: 0 0 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f0f2f5;
    display: flex;
    align-items: center;
}

.tags-header .tag-icon {
    font-size: 24px;
    color: var(--primary-color);
    background: rgba(108, 92, 231, 0.1);
    padding: 8px;
    border-radius: 8px;
    margin-right: 12px;
}

.tags-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -0.5px;
}

/* Empty State */
.empty-state {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #b2bec3;
    text-align: center;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 10px;
    opacity: 0.5;
}

.empty-state p {
    font-size: 14px;
    font-weight: 500;
}

/* App Header */
.app-header {
    text-align: center;
    margin-bottom: 30px;
}

.app-header .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 5px;
}

.app-header .logo i {
    font-size: 32px;
    color: #ff0000;
}

.app-header .logo h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -0.5px;
}

.app-header .subtitle {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 500;
}

.wrapper .search-section {
    width: 100%;
}

/* Enhanced Input Field */
.wrapper .search-section .field {
    height: 60px;
    width: 100%;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    background: #f1f3f5;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.01);
    margin-bottom: 10px;
}

.wrapper .search-section .field:focus-within {
    border-color: var(--primary-color);
    background: #fff;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.15);
}

.field-icon {
    position: absolute;
    left: 20px;
    font-size: 22px;
    color: var(--text-light);
    transition: color 0.3s;
    z-index: 2;
    pointer-events: none;
}

.wrapper .search-section .field:focus-within .field-icon {
    color: var(--primary-color);
}

.field input {
    width: 100%;
    height: 100%;
    padding: 24px 20px 8px 54px;
    background: transparent;
    border: none;
    outline: none;
    font-size: 16px;
    color: var(--text-color);
    z-index: 1;
    font-weight: 500;
}

.floating-label {
    position: absolute;
    left: 54px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 15px;
    color: var(--text-light);
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 2;
}

.field input:focus ~ .floating-label,
.field input:not(:placeholder-shown) ~ .floating-label {
    top: 16px;
    font-size: 12px;
    color: var(--primary-color);
    font-weight: 600;
}

.field .bottom-line {
    position: absolute;
    width: 100%;
    height: 3px;
    bottom: 0;
    left: 0;
    background: var(--primary-color);
    transform: scaleX(0);
    transition: transform 0.3s ease;
    transform-origin: left;
}

.field input:focus ~ .bottom-line,
.field input:valid ~ .bottom-line {
    transform: scaleX(1);
}

/* Tag Container */
#tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 60px;
    max-height: 400px; /* Increased height for desktop */
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    margin: 0 0 20px;
    overflow-y: auto;
    background: #fafafa;
}

/* Custom Scrollbar */
#tags-list::-webkit-scrollbar {
    width: 6px;
}
#tags-list::-webkit-scrollbar-track {
    background: transparent;
}
#tags-list::-webkit-scrollbar-thumb {
    background: #dcdde1;
    border-radius: 10px;
}
#tags-list::-webkit-scrollbar-thumb:hover {
    background: #b2bec3;
}

#tags-list li {
    color: var(--text-color);
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 14px;
    list-style: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

#tags-list li:hover {
    background: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(108, 92, 231, 0.3);
}

/* Bottom Actions */
.content .details {
    justify-content: space-between;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(0,0,0,0.04);
}

.content .details p {
    font-size: 14px;
    color: var(--text-light);
    font-weight: 500;
}

.content .details p span {
    font-weight: 700;
    color: var(--primary-color);
}

.action-buttons {
    display: flex;
    gap: 12px;
}

.content .details button, .copy-btn {
    outline: none;
    border: none;
    color: #fff;
    cursor: pointer;
    background: var(--primary-color);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(108, 92, 231, 0.2);
}

.content .details button:hover, .copy-btn:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(108, 92, 231, 0.3);
}

.content .details button:active, .copy-btn:active {
    transform: translateY(0);
}

/* Message Box */
.message-box {
    margin: 15px 0;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    display: none;
    animation: fadeIn 0.3s ease;
}

.message-box.error {
    background: #fff5f5;
    color: #e17055;
    border: 1px solid #fab1a0;
    border-left: 4px solid #e17055;
}

/* Video Card */
.video-details {
    display: flex;
    flex-direction: column;
    margin: 0 0 20px;
    background: #fff;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 15px rgba(0,0,0,0.03);
    transition: all 0.3s ease;
}

.video-details:hover {
    box-shadow: 0 8px 25px rgba(0,0,0,0.06);
}

.video-header {
    display: flex;
    align-items: flex-start;
}

.video-details img {
    width: 110px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    margin-right: 16px;
    flex-shrink: 0;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.video-details .info {
    flex: 1;
}

.channel-info, .video-meta {
    font-size: 13px;
    color: var(--text-light);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.channel-info span, .video-meta span {
    display: inline-block;
}

.dot {
    font-weight: bold;
    color: var(--border-color);
}

.video-details .video-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 5px;
    line-height: 1.3;
}

.video-details .video-stats {
    display: flex;
    gap: 15px;
    font-size: 14px;
    color: var(--text-light);
    margin-top: 10px;
}

.video-actions {
    margin-top: 15px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.action-link {
    font-size: 13px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s;
    background: rgba(108, 92, 231, 0.1);
    padding: 8px 12px;
    border-radius: 6px;
}

.action-link:hover {
    background: var(--primary-color);
    color: #fff;
    transform: translateY(-2px);
}

/* Top Comment Styles */
.top-comment-box {
    background: #fafafa;
    border-radius: 8px;
    padding: 15px;
    border: 1px solid var(--border-color);
}

.comment-author {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.comment-author img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.comment-author #comment-author-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text-color);
}

.comment-author #comment-date {
    font-size: 12px;
    color: var(--text-light);
}

#comment-text {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-color);
    margin-bottom: 10px;
    white-space: pre-wrap; /* Preserve line breaks */
}

.comment-likes {
    font-size: 13px;
    color: var(--text-light);
    display: flex;
    align-items: center;
    gap: 5px;
}

.accordion {
    margin-top: 0;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

.accordion-header {
    padding: 12px 18px;
    background: #fff;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
    transition: background 0.2s;
}

.accordion-header:hover {
    background: #f8f9fa;
}

.accordion-content {
    display: none;
    padding: 15px;
    background: #fafafa;
    border-top: 1px solid var(--border-color);
}

.accordion-content.active {
    display: block;
    animation: slideDown 0.3s ease-out;
}

.desc-text {
    width: 100%;
    height: 120px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    font-size: 13px;
    color: var(--text-light);
    resize: none;
    margin-bottom: 12px;
    background: #fff;
    line-height: 1.6;
}

.desc-text:focus {
    outline: none;
    border-color: var(--primary-color);
}

.copy-btn.sm {
    padding: 8px 16px;
    font-size: 12px;
    width: 100%;
}

/* Loader */
.loader {
    text-align: center;
    color: var(--primary-color);
    font-size: 14px;
    font-weight: 500;
    margin: 15px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.loader::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid var(--primary-color);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Footer */
.footer {
    margin-top: 30px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    text-align: center;
}

/* Mobile Responsiveness */
@media (max-width: 550px) {
    .wrapper {
        padding: 20px;
        margin: 10px;
        border-radius: 12px;
    }
    
    .video-header {
        flex-direction: column;
    }
    
    .video-details img {
        width: 100%;
        height: 180px;
        margin-right: 0;
        margin-bottom: 12px;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .content .details button {
        width: 100%;
    }
    
    .tags-header h2 {
        font-size: 16px;
    }
    
    .tags-header .tag-icon {
        font-size: 20px;
        padding: 6px;
    }
}

/* Small Mobile Devices */
@media (max-width: 380px) {
    .wrapper {
        padding: 15px;
    }
    
    .wrapper .url-field .field {
        height: 50px;
    }
    
    .field input {
        font-size: 14px;
        padding-left: 45px;
    }
    
    .field-icon {
        font-size: 18px;
        left: 15px;
    }
    
    .floating-label {
        left: 45px;
        font-size: 13px;
    }
}