/* --- General Styling --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

/* --- Header --- */
.header {
    background-color: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 10px 0;
}

.nav {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    color: #dc3545;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background-color: #dc3545;
    border-radius: 4px;
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.nav-links {
    display: flex;
    gap: 30px;
    align-items: center;
}

.nav-links a {
    text-decoration: none;
    color: #666;
    font-size: 14px;
    transition: color 0.3s;
}

.nav-links a:hover {
    color: #dc3545;
}

/* --- Main Container --- */
.main-container {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px;
}

.download-section {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 40px;
    text-align: center;
    margin-bottom: 40px;
}

.section-title {
    font-size: 32px;
    color: #333;
    margin-bottom: 20px;
    font-weight: 600;
}

.section-subtitle {
    color: #666;
    margin-bottom: 30px;
    font-size: 16px;
}

/* --- Form Input --- */
.url-input-form {
    display: flex;
    gap: 0;
    max-width: 600px;
    margin: 0 auto;
    border: 3px solid #e91e63;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(233, 30, 99, 0.2);
}

#youtube-url {
    flex-grow: 1;
    padding: 15px 20px;
    font-size: 16px;
    border: none;
    outline: none;
    background-color: #fff;
    color: #999;
}

#youtube-url::placeholder {
    color: #999;
    font-size: 14px;
}

#submit-btn {
    padding: 15px 25px;
    font-size: 16px;
    font-weight: bold;
    color: #fff;
    background-color: #e91e63;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

#submit-btn:hover {
    background-color: #c2185b;
}

#submit-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

/* --- Status & Results Area --- */
#status-area {
    margin-top: 30px;
}

.hidden {
    display: none !important;
}

/* Spinner Animation */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: #dc3545;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

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

/* Error Message */
#error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
}

/* Video Info */
#video-info {
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    text-align: left;
    margin-top: 20px;
}

#video-thumbnail {
    width: 100%;
    max-width: 320px;
    height: 180px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#video-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    line-height: 1.4;
}

.video-meta {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
}

/* Format Tabs */
.format-tabs {
    display: flex;
    margin: 20px 0 15px 0;
    border-bottom: 1px solid #eee;
    justify-content: center;
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    font-size: 14px;
    color: #666;
    transition: all 0.3s ease;
    font-weight: 500;
}

.tab-btn.active {
    color: #e91e63;
    border-bottom-color: #e91e63;
}

.tab-btn:hover {
    background-color: #f5f5f5;
}

/* Format Table */
.format-table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    margin: 20px 0;
}

.format-header {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    padding: 12px 15px;
    background: #f8f9fa;
    font-weight: 600;
    color: #555;
    border-bottom: 1px solid #ddd;
    font-size: 13px;
}

.format-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    padding: 15px;
    border-bottom: 1px solid #eee;
    align-items: center;
}

.format-row:last-child {
    border-bottom: none;
}

.format-row:hover {
    background-color: #f8f9fa;
}

.col-file-type {
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.col-format {
    color: #666;
    font-size: 13px;
    text-align: center;
}

.col-action {
    text-align: right;
}

.download-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s ease;
    min-width: 90px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

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

.download-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Reset Button */
.reset-button {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    margin-top: 15px;
    transition: background-color 0.3s;
}

.reset-button:hover {
    background-color: #5a6268;
}

/* Terms Notice */
.terms-notice {
    text-align: center;
    margin-top: 15px;
    font-size: 12px;
    color: #999;
}

.terms-notice a {
    color: #e91e63;
    text-decoration: none;
}

/* --- Info Section --- */
.info-section {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 40px;
    margin-bottom: 40px;
}

.info-title {
    font-size: 24px;
    color: #333;
    text-align: center;
    margin-bottom: 30px;
    font-weight: 600;
}

.info-content {
    display: flex;
    justify-content: space-between;
    gap: 40px;
}

.info-left {
    flex: 1;
}

.info-right {
    flex: 1;
}

.info-steps {
    list-style: none;
    counter-reset: step-counter;
}

.info-steps li {
    margin-bottom: 15px;
    color: #666;
    font-size: 14px;
    counter-increment: step-counter;
    position: relative;
    padding-left: 30px;
}

.info-steps li:before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    background-color: #dc3545;
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.features-list {
    list-style: none;
}

.features-list li {
    margin-bottom: 10px;
    color: #666;
    font-size: 14px;
    position: relative;
    padding-left: 20px;
}

.features-list li:before {
    content: "✓";
    color: #28a745;
    font-weight: bold;
    position: absolute;
    left: 0;
}

/* --- Feature Cards --- */
.feature-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
    margin-top: 40px;
    margin-bottom: 20px;
}

.feature-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 30px;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
}

.feature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.feature-icon {
    font-size: 48px;
    color: #dc3545;
    margin-bottom: 20px;
}

.feature-title {
    font-size: 18px;
    color: #333;
    margin-bottom: 15px;
    font-weight: bold;
}

.feature-description {
    color: #666;
    font-size: 14px;
    line-height: 1.5;
}

/* --- FAQ Section --- */
.faq-section {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 40px;
    margin-bottom: 40px;
}

.faq-item {
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 20px;
}

.faq-question {
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
    font-size: 16px;
}

.faq-answer {
    color: #666;
    font-size: 14px;
    line-height: 1.6;
}

/* --- Footer --- */
.footer {
    background-color: #333;
    color: white;
    text-align: center;
    padding: 30px 20px;
    margin-top: 60px;
}

.footer p {
    font-size: 14px;
    opacity: 0.8;
}

/* Mobile Menu Styles */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: #483d8b;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.mobile-menu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.mobile-menu-toggle span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: #483d8b;
    margin: 5px 0;
    transition: 0.3s;
    border-radius: 2px;
}

.mobile-menu-toggle.active span:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.mobile-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.active span:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 9999;
    transition: left 0.3s ease;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

.mobile-menu.active {
    left: 0;
}

.mobile-menu-header {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mobile-menu-logo {
    display: flex;
    align-items: center;
    color: white;
    text-decoration: none;
    font-size: 18px;
    font-weight: 600;
}

.mobile-menu-logo img {
    width: 32px;
    height: 32px;
    margin-right: 10px;
}

.mobile-menu-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

.mobile-menu-nav {
    padding: 20px 0;
}

.mobile-menu-nav a {
    display: block;
    padding: 15px 20px;
    color: white;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu-nav a:hover,
.mobile-menu-nav a:focus {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

.mobile-menu-nav a:last-child {
    border-bottom: none;
}

.mobile-menu-nav i {
    width: 20px;
    margin-right: 10px;
    text-align: center;
}

.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
}

/* Animation for menu items */
.mobile-menu-nav a {
    transform: translateX(-20px);
    opacity: 0;
    animation: slideInLeft 0.3s ease forwards;
}

.mobile-menu.active .mobile-menu-nav a:nth-child(1) {
    animation-delay: 0.1s;
}

.mobile-menu.active .mobile-menu-nav a:nth-child(2) {
    animation-delay: 0.15s;
}

.mobile-menu.active .mobile-menu-nav a:nth-child(3) {
    animation-delay: 0.2s;
}

.mobile-menu.active .mobile-menu-nav a:nth-child(4) {
    animation-delay: 0.25s;
}

@keyframes slideInLeft {
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Header adjustments */
.header {
    position: relative;
    z-index: 1000;
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* --- Mobile Responsive Design --- */
@media (max-width: 768px) {
    .main-container {
        margin: 20px auto;
        padding: 0 15px;
    }

    .download-section {
        padding: 25px 20px;
        margin-bottom: 25px;
    }

    .section-title {
        font-size: 24px;
        margin-bottom: 15px;
    }

    .section-subtitle {
        font-size: 14px;
        margin-bottom: 25px;
    }

    /* Mobile Form Styling */
    .url-input-form {
        max-width: 100%;
        border-radius: 6px;
        border-width: 2px;
    }

    #youtube-url {
        padding: 14px 16px;
        font-size: 14px;
    }

    #youtube-url::placeholder {
        font-size: 13px;
    }

    #submit-btn {
        padding: 14px 20px;
        font-size: 14px;
    }

    /* Mobile Video Info */
    #video-info {
        padding: 15px;
        border-radius: 8px;
    }

    #video-thumbnail {
        width: 100%;
        height: auto;
        max-height: 200px;
        margin-bottom: 12px;
    }

    #video-title {
        font-size: 16px;
        margin-bottom: 6px;
    }

    .video-meta {
        font-size: 13px;
        margin-bottom: 15px;
    }

    /* Mobile Format Tabs */
    .format-tabs {
        margin: 15px 0 10px 0;
        justify-content: center;
    }

    .tab-btn {
        padding: 10px 20px;
        font-size: 13px;
        border-bottom-width: 2px;
    }

    /* Mobile Format Table */
    .format-table {
        margin: 15px 0;
        border: 1px solid #ddd;
        border-radius: 6px;
    }

    .format-header {
        padding: 10px 12px;
        font-size: 12px;
        grid-template-columns: 1fr 80px 90px;
    }

    .format-row {
        padding: 12px;
        grid-template-columns: 1fr 80px 90px;
        gap: 8px;
    }

    .col-file-type {
        font-size: 13px;
    }

    .col-format {
        font-size: 12px;
    }

    .download-btn {
        padding: 6px 12px;
        font-size: 11px;
        min-width: 75px;
        border-radius: 15px;
    }

    /* Terms Notice */
    .terms-notice {
        margin-top: 20px;
        padding: 0 10px;
        font-size: 11px;
    }

    /* Mobile Info Section */
    .info-content {
        flex-direction: column;
        gap: 25px;
    }

    .info-section {
        padding: 25px 20px;
    }

    .info-title {
        font-size: 20px;
        margin-bottom: 20px;
    }

    /* Mobile Navigation */
    .nav-links {
        display: none;
    }

    .logo {
        font-size: 20px;
    }

    .logo-icon {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }

    /* Mobile Feature Cards */
    .feature-cards {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-top: 30px;
    }

    .feature-card {
        padding: 25px 20px;
    }

    .feature-icon {
        font-size: 40px;
        margin-bottom: 15px;
    }

    .feature-title {
        font-size: 16px;
        margin-bottom: 12px;
    }

    .feature-description {
        font-size: 13px;
    }

    /* Mobile FAQ */
    .faq-section {
        padding: 25px 20px;
    }

    .faq-question {
        font-size: 15px;
    }

    .faq-answer {
        font-size: 13px;
    }

    .format-header,
    .format-row {
        grid-template-columns: 2fr 1fr 1fr;
        padding: 15px 20px;
    }

    .download-btn {
        min-width: 100px;
        padding: 10px 20px;
        font-size: 13px;
    }

    .nav-links {
        display: none;
    }

    .mobile-menu-toggle {
        display: block;
    }

    .mobile-menu {
        display: block;
    }

    .nav {
        padding: 10px 15px;
    }

    .logo {
        font-size: 16px;
    }

    /* Prevent body scroll when menu is open */
    body.menu-open {
        overflow: hidden;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .main-container {
        padding: 0 10px;
    }

    .download-section {
        padding: 20px 15px;
    }

    .section-title {
        font-size: 22px;
    }

    #video-info {
        padding: 12px;
    }

    .format-header {
        padding: 8px 10px;
        font-size: 11px;
    }

    .format-row {
        padding: 10px;
    }

    .col-file-type,
    .col-format.col-action,
    .format-header {
        font-size: 14px;
    }

    .download-btn {
        padding: 5px 10px;
        font-size: 14px;
        min-width: 70px;
    }

    .info-section,
    .faq-section {
        padding: 20px 15px;
    }

    .thumbnail-video {
        text-align: center;
    }

    .format-header,
    .format-row {
        grid-template-columns: 30% 22% 48%;
    }

    .col-action {
        text-align: center;
    }

    .mobile-menu {
        width: 100%;
    }

    .logo span {
        font-size: 20px;
    }
}

.language-dropdown {
    margin-left: 15px;
}

.language-dropdown select {
    appearance: none;
    background: #fff;
    border-radius: 8px;
    padding: 8px 30px 8px 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23007bff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 8px center;
    background-repeat: no-repeat;
    background-size: 16px;
    min-width: 120px;
}

.language-dropdown select:hover {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23ffffff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.language-dropdown select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}

.language-dropdown select option {
    background: white;
    color: #333;
    padding: 10px;
}

/* Mobile Language Dropdown */
.mobile-language-dropdown {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.mobile-language-dropdown label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    padding-left: 20px;
}

.mobile-language-dropdown select {
    appearance: none;
    width: calc(100% - 40px);
    margin: 0 20px;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px 40px 15px 15px;
    font-size: 15px;
    font-weight: 500;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23666666' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
}

.mobile-language-dropdown select:hover,
.mobile-language-dropdown select:focus {
    background-color: #e9ecef;
    border-color: #007bff;
    outline: none;
}

.mobile-language-dropdown select option {
    background: white;
    color: #333;
    padding: 10px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .language-dropdown {
        display: none;
    }
}

@media (min-width: 769px) {
    .mobile-language-dropdown {
        display: none;
    }
}

/* Custom styling cho Safari và iOS */
@media screen and (-webkit-min-device-pixel-ratio:0) {
    .language-dropdown select,
    .mobile-language-dropdown select {
        background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%23007bff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    }
}