/* ==========================================================================
   VHieu Web Translator – Modern Premium UI Design System
   Version: 1.1.0
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --vwt-primary:         #2563eb;       /* Royal Blue */
    --vwt-primary-hover:   #1d4ed8;
    --vwt-primary-soft:    #eff6ff;
    --vwt-primary-glow:    rgba(37, 99, 235, 0.18);
    
    --vwt-accent:          #059669;       /* Emerald Green */
    --vwt-accent-hover:    #047857;
    --vwt-accent-soft:     #ecfdf5;

    --vwt-dark:            #0f172a;       /* Slate 900 */
    --vwt-dark-card:       #1e293b;
    --vwt-gray-50:         #f8fafc;
    --vwt-gray-100:        #f1f5f9;
    --vwt-gray-200:        #e2e8f0;
    --vwt-gray-300:        #cbd5e1;
    --vwt-gray-400:        #94a3b8;
    --vwt-gray-500:        #64748b;
    --vwt-gray-600:        #475569;
    --vwt-gray-700:        #334155;
    --vwt-gray-800:        #1e293b;
    
    --vwt-error:           #ef4444;
    --vwt-error-soft:      #fef2f2;

    --vwt-radius-sm:       8px;
    --vwt-radius-md:       12px;
    --vwt-radius-lg:       16px;
    --vwt-radius-full:     9999px;

    --vwt-shadow-sm:       0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --vwt-shadow-md:       0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --vwt-shadow-lg:       0 10px 25px -3px rgba(15, 23, 42, 0.08), 0 4px 10px -4px rgba(15, 23, 42, 0.04);
    --vwt-shadow-xl:       0 20px 35px -5px rgba(15, 23, 42, 0.12), 0 8px 16px -6px rgba(15, 23, 42, 0.06);

    --vwt-font:            'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --vwt-trans:           all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Box Sizing Reset ---- */
.vwt-wrapper, .vwt-wrapper * {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Card Wrapper Container
   ========================================================================== */
.vwt-wrapper {
    font-family: var(--vwt-font);
    background: #ffffff;
    border: 1px solid var(--vwt-gray-200);
    border-radius: var(--vwt-radius-lg);
    box-shadow: var(--vwt-shadow-lg);
    overflow: hidden;
    margin: 20px 0 32px;
    transition: var(--vwt-trans);
}

.vwt-wrapper:hover {
    box-shadow: var(--vwt-shadow-xl);
    border-color: var(--vwt-gray-300);
}

/* ==========================================================================
   Header Bar
   ========================================================================== */
.vwt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #ffffff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.vwt-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vwt-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: var(--vwt-radius-md);
    font-size: 20px;
    backdrop-filter: blur(8px);
}

.vwt-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.02em;
}

.vwt-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 5px 12px;
    border-radius: var(--vwt-radius-full);
    display: flex;
    align-items: center;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.vwt-badge img {
    filter: brightness(0) invert(1);
    opacity: 0.9;
    height: 15px;
}

/* ==========================================================================
   Input Section
   ========================================================================== */
.vwt-input-area {
    padding: 24px;
    background: #ffffff;
    border-bottom: 1px solid var(--vwt-gray-200);
}

/* Row 1: URL input + Primary Actions */
.vwt-input-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.vwt-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
    background: var(--vwt-gray-50);
    border: 2px solid var(--vwt-gray-200);
    border-radius: var(--vwt-radius-md);
    transition: var(--vwt-trans);
    min-width: 0;
}

.vwt-input-wrap:hover {
    border-color: var(--vwt-gray-300);
    background: #ffffff;
}

.vwt-input-wrap:focus-within {
    border-color: var(--vwt-primary);
    background: #ffffff;
    box-shadow: 0 0 0 4px var(--vwt-primary-glow);
}

.vwt-input-icon {
    padding-left: 16px;
    font-size: 16px;
    color: var(--vwt-gray-400);
    user-select: none;
    display: flex;
    align-items: center;
}

.vwt-url-input {
    flex: 1;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    background: transparent !important;
    padding: 13px 14px !important;
    font-size: 15px !important;
    color: var(--vwt-gray-800) !important;
    font-family: inherit !important;
    min-width: 0;
    line-height: 1.5;
}

.vwt-url-input::placeholder {
    color: var(--vwt-gray-400);
}

.vwt-clear-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 14px;
    color: var(--vwt-gray-400);
    font-size: 16px;
    transition: var(--vwt-trans);
    display: flex;
    align-items: center;
    justify-content: center;
}

.vwt-clear-btn:hover {
    color: var(--vwt-error);
    transform: scale(1.1);
}

/* Button Dịch */
.vwt-translate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 24px;
    background: var(--vwt-primary);
    color: #ffffff !important;
    border: none;
    border-radius: var(--vwt-radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--vwt-trans);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
    min-height: 48px;
}

.vwt-translate-btn:hover {
    background: var(--vwt-primary-hover);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
}

.vwt-translate-btn:active {
    transform: translateY(1px);
}

.vwt-translate-btn:disabled {
    background: var(--vwt-gray-300);
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

/* Button Chia sẻ nhanh cạnh ô nhập */
.vwt-btn-share-quick {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 20px;
    background: var(--vwt-accent);
    color: #ffffff !important;
    border: none;
    border-radius: var(--vwt-radius-md);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--vwt-trans);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25);
    min-height: 48px;
}

.vwt-btn-share-quick:hover {
    background: var(--vwt-accent-hover);
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
    transform: translateY(-1px);
}

.vwt-btn-share-quick:active {
    transform: translateY(1px);
}

/* ==========================================================================
   Row 2: Language Selection Toolbar
   ========================================================================== */
.vwt-lang-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    background: var(--vwt-gray-50);
    padding: 10px 16px;
    border-radius: var(--vwt-radius-md);
    border: 1px solid var(--vwt-gray-200);
}

.vwt-lang-group {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 140px;
}

.vwt-lang-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--vwt-gray-600);
    white-space: nowrap;
    margin: 0;
}

.vwt-select {
    flex: 1;
    border: 1px solid var(--vwt-gray-300) !important;
    border-radius: var(--vwt-radius-sm) !important;
    padding: 8px 12px !important;
    font-size: 13.5px !important;
    font-weight: 500 !important;
    background: #ffffff !important;
    color: var(--vwt-gray-800) !important;
    cursor: pointer;
    outline: none !important;
    box-shadow: var(--vwt-shadow-sm) !important;
    transition: var(--vwt-trans);
    height: 38px;
    line-height: normal;
}

.vwt-select:focus {
    border-color: var(--vwt-primary) !important;
    box-shadow: 0 0 0 3px var(--vwt-primary-glow) !important;
}

/* Swap button */
.vwt-swap-lang {
    background: #ffffff;
    border: 1px solid var(--vwt-gray-300);
    border-radius: var(--vwt-radius-full);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    color: var(--vwt-primary);
    box-shadow: var(--vwt-shadow-sm);
    transition: var(--vwt-trans);
    flex-shrink: 0;
}

.vwt-swap-lang:hover {
    background: var(--vwt-primary);
    border-color: var(--vwt-primary);
    color: #ffffff;
    transform: rotate(180deg);
}

/* ==========================================================================
   Quick suggestion pills
   ========================================================================== */
.vwt-quick-links {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
    font-size: 13px;
    color: var(--vwt-gray-500);
}

.vwt-quick-links > span {
    font-weight: 500;
}

.vwt-quick-btn {
    background: var(--vwt-gray-100);
    border: 1px solid var(--vwt-gray-200);
    border-radius: var(--vwt-radius-full);
    padding: 5px 12px;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    color: var(--vwt-gray-700);
    transition: var(--vwt-trans);
}

.vwt-quick-btn:hover {
    background: var(--vwt-primary-soft);
    border-color: var(--vwt-primary);
    color: var(--vwt-primary);
    transform: translateY(-1px);
}

/* ==========================================================================
   Display Area & State Screens
   ========================================================================== */
.vwt-display-area {
    position: relative;
    background: #ffffff;
    min-height: 280px;
}

.vwt-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 64px 24px;
    text-align: center;
}

.vwt-state-empty .vwt-state-icon {
    font-size: 54px;
    margin-bottom: 16px;
    opacity: 0.85;
}

.vwt-state-empty p {
    font-size: 15px;
    color: var(--vwt-gray-500);
    max-width: 420px;
    margin: 0;
    line-height: 1.6;
}

/* Loading */
.vwt-state-loading {
    gap: 20px;
    padding: 80px 24px;
}

.vwt-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--vwt-gray-100);
    border-top-color: var(--vwt-primary);
    border-radius: 50%;
    animation: vwt-spin 0.8s linear infinite;
}

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

.vwt-loading-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--vwt-gray-700);
    margin: 0;
}

/* Error */
.vwt-state-error {
    background: var(--vwt-error-soft);
    padding: 40px 24px;
    margin: 24px;
    border-radius: var(--vwt-radius-md);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.vwt-state-error .vwt-state-icon {
    font-size: 36px;
    margin-bottom: 8px;
}

.vwt-error-text {
    font-size: 14px;
    font-weight: 500;
    color: var(--vwt-error);
    margin: 0 0 16px;
}

.vwt-retry-btn {
    padding: 8px 20px;
    background: var(--vwt-error);
    color: #ffffff;
    border: none;
    border-radius: var(--vwt-radius-sm);
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--vwt-trans);
}

.vwt-retry-btn:hover {
    background: #dc2626;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.3);
}

/* ==========================================================================
   Active Content Toolbar
   ========================================================================== */
.vwt-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: var(--vwt-gray-50);
    border-bottom: 1px solid var(--vwt-gray-200);
    flex-wrap: wrap;
    gap: 12px;
}

.vwt-toolbar-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.vwt-current-url-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--vwt-gray-500);
    white-space: nowrap;
}

.vwt-current-url-link {
    color: var(--vwt-primary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    max-width: 380px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    padding: 3px 8px;
    background: #ffffff;
    border-radius: var(--vwt-radius-sm);
    border: 1px solid var(--vwt-gray-200);
    transition: var(--vwt-trans);
}

.vwt-current-url-link:hover {
    color: var(--vwt-primary-hover);
    border-color: var(--vwt-primary);
}

.vwt-toolbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vwt-tool-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    border: 1px solid var(--vwt-gray-300);
    border-radius: var(--vwt-radius-sm);
    padding: 7px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--vwt-gray-700);
    transition: var(--vwt-trans);
    white-space: nowrap;
    box-shadow: var(--vwt-shadow-sm);
}

.vwt-tool-btn:hover {
    background: var(--vwt-gray-100);
    color: var(--vwt-dark);
    border-color: var(--vwt-gray-400);
    transform: translateY(-1px);
}

.vwt-tool-btn.vwt-btn-share {
    background: var(--vwt-accent-soft);
    border-color: rgba(5, 150, 105, 0.3);
    color: var(--vwt-accent);
}

.vwt-tool-btn.vwt-btn-share:hover {
    background: var(--vwt-accent);
    color: #ffffff;
    border-color: var(--vwt-accent);
}

/* ==========================================================================
   Iframe & Fullscreen Mode
   ========================================================================== */
.vwt-iframe-container {
    position: relative;
    overflow: hidden;
    background: #ffffff;
}

.vwt-iframe-container.vwt-fullscreen {
    position: fixed !important;
    inset: 0 !important;
    z-index: 999999 !important;
    height: 100vh !important;
    width: 100vw !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

.vwt-iframe {
    width: 100%;
    height: 100%;
    display: block;
    border: none;
    background: #ffffff;
}

/* Utilities */
.vwt-hidden {
    display: none !important;
}

.vwt-admin-wrap .vwt-wrapper {
    max-width: 1240px;
    margin-top: 24px;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 768px) {
    .vwt-input-row {
        flex-direction: column;
    }

    .vwt-translate-btn,
    .vwt-btn-share-quick {
        width: 100%;
    }

    .vwt-lang-row {
        flex-direction: column;
        align-items: stretch;
    }

    .vwt-swap-lang {
        align-self: center;
    }

    .vwt-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .vwt-toolbar-right {
        width: 100%;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .vwt-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}
