/* Main styles for Vi Translator Extension */

:root {
    /* Màu chủ đạo */
    --primary-color: #ED1C24;
    --primary-light: rgba(237, 28, 36, 0.1);
    --primary-dark: #C41E3A;

    /* Màu phụ trợ */
    --secondary-color: #266EA3;
    --secondary-alt: #001952;
    --accent-color: #009838;
    --accent-light: rgba(0, 152, 56, 0.1);
    --yellow-color: #FF9800;

    /* Màu text */
    --text-color: #333333;
    --text-secondary: #666666;
    --text-navbar: #AAAAAA;
    --text-note: #009838;
    --text-brown: #8B4513;

    /* Màu nền và border */
    --border-color: #E8EAED;
    --background-color: #FFFFFF;
    --background-secondary: #F8F9FA;
    --hover-color: #F5F5F5;

    /* Màu trạng thái */
    --success-color: #009838;
    --error-color: #ED1C24;
    --warning-color: #FF9800;
    --info-color: #266EA3;
    --shadow-color: rgba(0, 0, 0, 0.1);

    --border-radius: 8px;
    --transition-speed: 0.2s;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-color);
    background-color: var(--background-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
.main-header {
    padding: 1rem 0;
    margin-bottom: 2rem;
    width: 100%;
    background-color: var(--background-color);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.header-content h1 {
    font-size: 1.8rem;
    margin: 0;
    color: var(--primary-color);
    white-space: nowrap;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 0;
}

.header-actions a {
    display: inline-flex;
    align-items: center;
    height: 40px;
    padding: 0 13px;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: all var(--transition-speed) ease;
}

.header-actions .btn.secondary {
    background-color: var(--primary-light);
    color: var(--primary-color);
    min-width: 140px;
    justify-content: center;
}

.header-actions .btn.secondary:hover {
    background-color: rgba(237, 28, 36, 0.15);
}

.header-actions .btn-feedback {
    background-color: var(--accent-light);
    color: var(--accent-color);
    min-width: 188px;
    justify-content: center;
}

.header-actions .btn-feedback:hover {
    background-color: rgba(0, 152, 56, 0.15);
}

.header-actions svg {
    margin-right: 0px;
    flex-shrink: 0;
}

.tagline {
    font-size: 18px;
    color: var(--text-secondary);
    margin-top: 1rem;
    text-align: left;
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-content h1 {
        font-size: 1.5rem;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Hero Layout (2-column) */
.hero-section {
    display: flex;
    min-height: 50vh;
    padding: 40px 0;
    gap: 40px;
    padding-bottom: 20px;
    padding-top: 0px;
}

.hero-left {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.hero-right {
    flex: 1;
    align-items: center;
}

/* API Key Section */
.api-key-section {
    padding: 30px;
    background-color: var(--background-secondary);
    border-radius: var(--border-radius);
    margin-bottom: 20px;
    box-shadow: 0 4px 12px var(--shadow-color);
    border: 1px solid var(--border-color);
}

.api-key-section h2 {
    font-size: 22px;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.section-desc {
    margin-bottom: 20px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.create-key-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
    background-color: var(--background-secondary);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.create-key-inputs {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 15px;
}

.input-group {
    flex: 1;
    min-width: 200px;
}

/* Input container styles */
.input-container {
    position: relative;
    width: 100%;
    margin-bottom: 8px;
}

.input-with-icon {
    padding: 12px 16px 12px 42px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 15px;
    width: 100%;
    height: 100%;
    transition: all 0.2s ease;
}

.input-with-icon:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.input-icon-left {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    pointer-events: none;
}

.input-icon-right {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    cursor: pointer;
}

.input-icon-right:hover {
    color: var(--text-color);
}

.error-container {
    margin-bottom: 5px;
}

.create-key-form input[type="email"] {
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 14px;
    width: 100%;
    height: 100%;
}

input[type="email"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.error {
    color: var(--error-color);
    font-size: 14px;
    margin-top: 5px;
    display: block;
}

.success-message {
    display: none;
    margin-top: 20px;
    text-align: center;
}

.success-content {
    background-color: #f8f9fa;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.success-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.success-message p {
    color: #202124;
    font-size: 16px;
    margin: 8px 0;
}

.facebook-invite {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e8eaed;
}

.facebook-invite p {
    color: #5f6368;
    font-size: 15px;
    margin-bottom: 16px;
}

.facebook-join-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--secondary-color);
    color: white;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 500;
    transition: all var(--transition-speed) ease;
}

.facebook-join-btn:hover {
    background-color: var(--secondary-alt);
}

.facebook-join-btn svg {
    flex-shrink: 0;
}

/* Download Section */
.download-section {
    margin-bottom: 20px;
}

/* Mini Features */
.features-mini {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
}

.feature-mini {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background-color: var(--background-secondary);
    border-radius: var(--border-radius);
    font-weight: 500;
}

.feature-icon-mini {
    display: flex;
}

/* Tutorial Section */
.tutorial-section {
    width: 100%;
}

.tutorial-section h2 {
    font-size: 22px;
    margin-bottom: 10px;
    margin-top: -15px;
    color: var(--primary-color);
}

.video-container {
    position: relative;
    width: 100%;
    padding-bottom: 45.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 30px var(--shadow-color);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Benefits Section */
.benefits-section {
    padding: 60px 0;
    text-align: center;
    padding-top: 0px;
}

.benefits-section h2 {
    font-size: 28px;
    margin-bottom: 28px;
    color: var(--primary-color);
}

.benefits {
    display: flex;
    gap: 30px;
    justify-content: center;
}

.benefit {
    flex: 1;
    max-width: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.benefit-icon {
    margin-bottom: 20px;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--background-secondary);
    box-shadow: 0 4px 10px var(--shadow-color);
    align-self: center; /* Ensure icon is centered within flex container */
    margin-left: auto;
    margin-right: auto;
}

.benefit h3 {
    font-size: 18px;
    margin-bottom: 10px;
}

.benefit p {
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: var(--border-radius);
    font-weight: 500;
    font-size: 16px;
    cursor: pointer;
    transition: all var(--transition-speed);
    text-decoration: none;
    border: none;
    width: 100%;
}

.btn svg {
    transition: transform var(--transition-speed);
}

.btn:hover svg {
    transform: translateX(2px);
}

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

.btn.primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

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

.btn.secondary:hover {
    background-color: var(--secondary-alt);
    border-color: var(--secondary-alt);
}

/* Footer */
.main-footer {
    padding: 20px 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    border-top: 1px solid var(--border-color);
}

/* Responsive Styles */
@media (max-width: 992px) {
    .hero-section {
        flex-direction: column;
        min-height: auto;
    }

    .hero-left, .hero-right {
        width: 100%;
    }

    .tutorial-section {
        margin-top: 30px;
    }

    .benefits {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 15px;
    }

    .hero-section {
        flex-direction: column;
        gap: 20px; /* Reduce gap between sections */
    }

    .hero-right {
        order: -1; /* Move video above the content on mobile */
    }

    .tutorial-section {
        margin-top: 0; /* Remove top margin */
    }

    .logo h1 {
        font-size: 24px;
    }

    .tagline {
        font-size: 16px;
    }

    .features-mini {
        flex-direction: column;
        gap: 15px;
    }

    .benefits {
        flex-direction: column;
        align-items: center; /* Center the benefit cards horizontally */
        gap: 20px;
    }

    .benefit {
        max-width: none; /* Allow benefits to be responsive */
        width: 100%; /* Take full width */
        align-items: center; /* Keep all content centered */
    }

    .video-container {
        padding-bottom: 56.25%; /* Maintain 16:9 aspect ratio */
    }

    .api-key-section, .download-section, .tutorial-section {
        padding: 20px 10px;
    }

    .success-content {
        padding: 20px;
    }

    .success-message p {
        font-size: 15px;
    }

    .facebook-join-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .success-content {
        padding: 16px;
    }

    .facebook-invite p {
        font-size: 14px;
    }
}

/* Language selector styles */
.language-selector {
    position: relative;
    margin-top: 10px;
    width: 100%;
}

.language-select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    width: 100%;
    padding: 12px 16px;
    padding-right: 40px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--background-color);
    cursor: pointer;
    font-size: 16px;
    color: var(--text-color);
    transition: all 0.2s ease;
}

.language-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.language-selector::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 72%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--text-secondary);
    pointer-events: none;
}

/* Custom styling for dropdown options */
.language-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
}

.language-flag {
    font-size: 20px;
}

.language-name {
    font-size: 14px;
}

/* Style for the selected option */
.selected-language {
    display: flex;
    align-items: center;
    gap: 8px;
}

.selected-flag {
    font-size: 20px;
}

.selected-name {
    font-size: 14px;
}

/* Make language selector responsive */
@media (max-width: 768px) {
    .language-select {
        padding: 10px 14px;
        padding-right: 36px;
        font-size: 14px;
    }

    .language-flag {
        font-size: 18px;
    }

    .language-name {
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .language-select {
        padding: 8px 12px;
        padding-right: 32px;
        font-size: 13px;
    }
}

/* Custom select with flags */
.custom-select-container {
    position: relative;
    width: 100%;
    margin-bottom: 15px;
    z-index: 100;
}

.custom-select-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 7px 16px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    background-color: var(--background-color);
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 101;
}

.custom-select-trigger:hover {
    border-color: var(--primary-color);
}

.custom-select-trigger::after {
    content: '';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid var(--text-secondary);
    transition: transform 0.2s ease;
}

.custom-select-container.open .custom-select-trigger::after {
    transform: translateY(-50%) rotate(180deg);
}

.custom-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-top: 0;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    z-index: 102;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    max-height: 300px;
    overflow-y: auto;
}

.custom-select-container.open .custom-options {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    transform: translateY(0);
    display: block !important;
}

.custom-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-option:hover {
    background-color: var(--background-secondary);
}

.custom-option.selected {
    background-color: var(--primary-light);
    color: var(--primary-color);
    font-weight: 500;
}

.option-flag {
    font-size: 20px;
    display: inline-block;
}

.option-name {
    font-size: 14px;
    display: inline-block;
}

/* Admin specific styles */
.create-key-form .custom-select-container {
    margin-bottom: 15px;
    width: 100%;
}

/* Fix for edit page */
#editLanguageSelectContainer {
    margin-bottom: 20px;
}

/* Add this to the existing styles.css file */

.loading-spinner-small {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    margin-right: 8px;
    animation: spin 1s linear infinite;
}

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

/* Feedback button styles */
.feedback-container {
    margin-top: 15px;
}

.top-feedback {
    margin-top: 0;
    display: flex;
    justify-content: flex-end;
}

.main-header {
    margin-bottom: 0px;
    display: flex;
    flex-direction: column;
}

.btn-feedback {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background-color: var(--yellow-color);
    color: var(--text-color);
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-speed);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.btn-feedback:hover {
    background-color: #f9b700;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-feedback svg {
    transition: transform var(--transition-speed);
}

.btn-feedback:hover svg {
    transform: rotate(-15deg);
}

/* Footer styles */
.main-footer {
    padding: 20px 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    border-top: 1px solid var(--border-color);
}

/* Responsive styles */
@media (max-width: 768px) {
    .main-footer {
        padding: 15px 10px;
    }

    .main-header {
        align-items: flex-start;
    }

    .top-feedback {
        align-self: flex-start;
    }
}

/* Success Popup */
.success-popup {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.popup-content {
    background-color: white;
    border-radius: 12px;
    padding: 32px;
    max-width: 420px;
    width: 90%;
    position: relative;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: popupFadeIn 0.3s ease-out;
}

@keyframes popupFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.close-btn:hover {
    background-color: var(--background-secondary);
    color: var(--text-color);
}

.success-title {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-color);
    margin: 16px 0;
}

.success-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 8px;
}

.facebook-invite {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.facebook-invite p {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.facebook-join-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #1877f2;
    color: white;
    text-decoration: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s;
    width: 100%;
    justify-content: center;
}

.facebook-join-btn:hover {
    background-color: #166fe5;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(24, 119, 242, 0.2);
}

.facebook-join-btn svg {
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .popup-content {
        padding: 24px;
    }

    .success-title {
        font-size: 16px;
    }

    .facebook-invite p {
        font-size: 14px;
    }

    .facebook-join-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}