/* ai-vietnam-pro/assets/css/style.css */

/* Reset đơn giản */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #0f172a;
    color: #e5e7eb;
    line-height: 1.5;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Layout chung */
.layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: #020617;
    border-right: 1px solid rgba(148, 163, 184, 0.2);
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sidebar-header .logo {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 0.03em;
}

.sidebar-header .subtitle {
    font-size: 13px;
    color: #9ca3af;
    margin-top: 4px;
}

/* Sidebar nav */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding-right: 4px;
}

.sidebar-nav::-webkit-scrollbar {
    width: 6px;
}
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.5);
    border-radius: 999px;
}

.nav-home {
    display: block;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 4px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.nav-home.active {
    background: linear-gradient(135deg, #22c55e, #3b82f6);
    border-color: transparent;
}

/* Nhóm dropdown sidebar */
.nav-section {
    margin-top: 8px;
}

/* Header dropdown của từng nhóm */
.nav-section-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    border: none;
    padding: 8px 6px;
    border-radius: 6px;
    cursor: pointer;
    color: #6b7280;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.nav-section-toggle:hover {
    background: rgba(15, 23, 42, 0.9);
}

.nav-section-title {
    font-size: 12px;
}

/* Icon mũi tên */
.nav-section-icon {
    font-size: 11px;
    transition: transform 0.15s ease;
}

/* Xoay icon khi mở */
.nav-section.open .nav-section-icon {
    transform: rotate(180deg);
}

/* Dropdown list: animation max-height mượt */
.nav-section .nav-list {
    list-style: none;
    padding-left: 4px;
    margin-bottom: 4px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
}

/* Khi mở dropdown: cho max-height đủ lớn để chứa item (trick animation) */
.nav-section.open .nav-list {
    max-height: 600px;
}

/* Item trong dropdown */
.nav-item {
    display: block;
    padding: 7px 10px;
    border-radius: 6px;
    font-size: 13px;
    color: #d1d5db;
    transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
    background: rgba(30, 64, 175, 0.4);
}

.nav-item.active {
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    color: #f9fafb;
}

/* Main */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 18px 20px;
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.page-title {
    font-size: 22px;
    font-weight: 600;
}

.page-subtitle {
    font-size: 14px;
    color: #9ca3af;
    margin-top: 4px;
}

/* Search */
.header-search {
    min-width: 280px;
    max-width: 420px;
    width: 100%;
}

.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    background: rgba(15, 23, 42, 0.9);
    color: #e5e7eb;
    font-size: 14px;
    outline: none;
}

.search-box input::placeholder {
    color: #6b7280;
}

.search-box.large input {
    padding: 14px 18px;
    font-size: 16px;
}

/* Suggestions dropdown */
.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #020617;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.9);
    max-height: 320px;
    overflow-y: auto;
    padding: 4px 0;
    display: none;
    z-index: 30;
}

.search-suggestions.visible {
    display: block;
}

.suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
}

.suggestion-item:hover {
    background: rgba(30, 64, 175, 0.6);
}

.suggestion-name {
    font-size: 14px;
}

.suggestion-meta {
    font-size: 11px;
    color: #9ca3af;
}

/* Main content */
.main-content {
    flex: 1;
    overflow-y: auto;
}

/* Card */
.card {
    background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.09), rgba(15, 23, 42, 1));
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    padding: 16px 18px;
    margin-bottom: 16px;
}

.card h2 {
    font-size: 18px;
    margin-bottom: 6px;
}

.card p {
    font-size: 14px;
    color: #d1d5db;
}

/* Home layout */
.home-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.4fr);
    gap: 16px;
}

.home-search-card {
    grid-column: 1 / -1;
}

/* Pills: nhóm tính năng (hàng trên) */
.pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.pill {
    padding: 8px 18px;
    font-size: 14px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    background: rgba(15, 23, 42, 0.9);
    cursor: pointer;
    font-weight: 500;
    transition:
        background 0.18s ease,
        border-color 0.18s ease,
        color 0.18s ease,
        box-shadow 0.18s ease,
        transform 0.12s ease;
}

.pill:hover {
    border-color: #38bdf8;
    background: rgba(15, 23, 42, 1);
}

.pill.active {
    background: linear-gradient(135deg, #4f46e5, #06b6d4);
    border-color: transparent;
    color: #f9fafb;
    box-shadow: 0 12px 30px rgba(37, 99, 235, 0.55);
    transform: translateY(-1px);
}

/* Danh sách tool theo nhóm phổ biến (hàng dưới) */
.popular-tools-result {
    margin-top: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.popular-tools-item {
    display: inline-block;
    font-size: 13px;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: rgba(15, 23, 42, 0.85);
    cursor: pointer;
    transition:
        background 0.15s ease,
        border-color 0.15s ease,
        transform 0.1s ease;
}

.popular-tools-item:hover {
    border-color: rgba(56, 189, 248, 0.7);
    background: rgba(15, 23, 42, 0.95);
    transform: translateY(-0.5px);
}

.popular-tools-empty {
    font-size: 13px;
    color: #9ca3af;
    margin-top: 4px;
}

/* Tool grid */
.tool-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 8px;
}

.tool-card {
    border-radius: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.9);
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
    display: block;
}

.tool-card h3 {
    font-size: 15px;
    margin-bottom: 4px;
}

.tool-card p {
    font-size: 13px;
    color: #9ca3af;
}

.tool-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 25px rgba(15, 23, 42, 0.8);
    border-color: #38bdf8;
}

/* Tool content (trong tools/*.php) */
.tool-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(0, 1.1fr);
    gap: 16px;
}

.tool-layout-single {
    max-width: 760px;
}

.tool-form h2 {
    font-size: 18px;
    margin-bottom: 8px;
}

.tool-form label {
    display: block;
    font-size: 13px;
    margin-bottom: 4px;
}

.tool-form textarea,
.tool-form input,
.tool-form select {
    width: 100%;
    border-radius: 10px;
    padding: 8px 10px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    background: rgba(15, 23, 42, 0.9);
    color: #e5e7eb;
    font-size: 14px;
    outline: none;
    resize: vertical;
}

.tool-form textarea {
    min-height: 140px;
}

.tool-form button {
    margin-top: 10px;
    padding: 9px 16px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(135deg, #22c55e, #3b82f6);
    color: #f9fafb;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
}

.tool-form button:hover {
    filter: brightness(1.05);
}

/* Result box */
.tool-result {
    margin-top: 10px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px dashed rgba(148, 163, 184, 0.7);
    background: rgba(15, 23, 42, 0.9);
    font-size: 14px;
    min-height: 60px;
    position: relative;          /* để đặt nút copy */
    padding-right: 70px;         /* chừa chỗ cho nút copy */
}

/* Nút copy trong result */
.copy-result-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.7);
    background: rgba(15, 23, 42, 0.95);
    color: #e5e7eb;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}

.copy-result-btn:hover {
    border-color: #38bdf8;
    background: rgba(15, 23, 42, 1);
    transform: translateY(-0.5px);
}

.copy-result-btn.copied {
    border-color: #22c55e;
    background: rgba(22, 163, 74, 0.2);
}

/* Coming soon */
.coming-soon {
    text-align: center;
    padding: 50px 16px;
}

.coming-soon h2 {
    font-size: 22px;
    margin-bottom: 8px;
}

.coming-soon p {
    font-size: 14px;
    color: #9ca3af;
}

/* Overlay loading toàn trang */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.18s ease;
    z-index: 999;
}

.loading-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.loading-box {
    padding: 14px 18px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.6);
    display: flex;
    align-items: center;
    gap: 10px;
}

.loading-spinner {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    border: 3px solid rgba(148, 163, 184, 0.45);
    border-top-color: #38bdf8;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    font-size: 13px;
    color: #e5e7eb;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 1024px) {
    .home-grid {
        grid-template-columns: minmax(0, 1fr);
    }
}

@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .main {
        padding: 12px;
    }

    .main-header {
        flex-direction: column;
        align-items: stretch;
    }

    .header-search {
        max-width: 100%;
    }

    .tool-layout {
        grid-template-columns: minmax(0, 1fr);
    }
}
