:root {
    /* Colors */
    --bg-color: #f1f5f9;
    --header-bg: #ffffff;
    --pill-bg: #06b6d4; /* Màu xanh lơ (cyan) giống hình vẽ */
    --pill-hover: #0891b2;
    --pill-text: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --transition: all 0.2s ease;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden; /* Ngăn scroll toàn trang, chỉ scroll trong iframe */
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* App Header (Nav Bar) */
.app-header {
    background-color: var(--header-bg);
    min-height: 60px;
    height: auto;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    z-index: 100;
}

.category-nav {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap; /* Cho phép nút rớt dòng nếu màn hình nhỏ */
}

/* Dropdown Menu styling */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    background-color: var(--pill-bg);
    color: var(--pill-text);
    padding: 0.5rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 9999px; /* Pill shape */
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    white-space: nowrap;
    transition: var(--transition);
}

.dropbtn:hover, .dropdown.active .dropbtn {
    background-color: var(--pill-hover);
    box-shadow: var(--shadow-sm);
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #ffffff;
    min-width: 180px;
    box-shadow: var(--shadow-md);
    border-radius: 8px;
    top: 100%; /* Dính sát vào nút để chuột không bị rơi ra ngoài */
    left: 0;
    z-index: 101;
    overflow: hidden;
    border: 1px solid var(--border-color);
    animation: fadeIn 0.2s ease;
}

/* Thêm vùng đệm vô hình để chuột không bị trượt khi di chuyển từ nút xuống menu */
.dropdown-content::before {
    content: '';
    position: absolute;
    top: -10px;
    left: 0;
    width: 100%;
    height: 10px;
}

.dropdown:hover .dropdown-content,
.dropdown.active .dropdown-content {
    display: block;
}

.dropdown-content a {
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    text-decoration: none;
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.15s;
    border-bottom: 1px solid #f1f5f9;
}

.dropdown-content a:last-child {
    border-bottom: none;
}

.dropdown-content a:hover, .dropdown-content a.selected {
    background-color: #f8fafc;
    color: #0284c7;
}

/* Header Right Actions */
.header-right {
    padding-left: 1rem;
}

.btn-external {
    font-size: 0.9rem;
    color: #0284c7;
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    background: #f0f9ff;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-external:hover {
    background: #e0f2fe;
}

/* App Workspace (Main content) */
.app-workspace {
    flex: 1;
    position: relative;
    background-color: var(--bg-color);
    background-image: url('anh/Van phong.jpg'); /* Sử dụng đúng ảnh của người dùng */
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
}

/* Welcome Screen */
.welcome-screen {
    position: absolute;
    top: 10px; /* Lên kịch trần luôn */
    left: 50%;
    transform: translate(-50%, 0);
    text-align: center;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 3rem 4rem;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.welcome-screen i {
    font-size: 5rem;
    color: #0284c7;
    margin-bottom: 1rem;
    display: block;
    filter: drop-shadow(0 4px 6px rgba(2, 132, 199, 0.2));
}

.welcome-screen h2 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.welcome-screen p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* Loader */
.loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid #cbd5e1;
    border-top-color: var(--pill-bg);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

/* Iframe */
#data-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 125%; /* 100% / 0.8 để bù cho scale */
    height: 125%; /* 100% / 0.8 để bù cho scale */
    transform: scale(0.8);
    transform-origin: 0 0;
    z-index: 20;
    background: #ffffff;
    border: none;
}

@keyframes spin {
    to { transform: translate(-50%, -50%) rotate(360deg); }
}

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