﻿/* style.css: Modern Tech Dashboard Theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #4f46e5; /* Indigo 600 */
    --primary-dark: #4338ca;
    --primary-light: #818cf8;
    --secondary: #10b981; /* Emerald 500 */
    --accent: #f59e0b; /* Amber 500 */
    --danger: #ef4444; /* Red 500 */
    --dark: #1e293b; /* Slate 800 */
    --text-main: #334155; /* Slate 700 */
    --text-light: #64748b; /* Slate 500 */
    --bg-body: #f1f5f9; /* Slate 100 */
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 16px;
    --sidebar-width: 280px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
}

/* --- Auth Pages (Login/Register) --- */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top left, #e0e7ff, #f1f5f9, #fff);
    padding: 20px;
}

.auth-container {
    background: var(--bg-card);
    width: 100%;
    max-width: 450px;
    padding: 40px;
    border-radius: 24px;
    box-shadow: var(--shadow-lg);
    text-align: center;
    animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.auth-header i { font-size: 3.5em; color: var(--primary); margin-bottom: 20px; filter: drop-shadow(0 4px 6px rgba(79, 70, 229, 0.2)); }
.auth-header h1 { font-size: 2em; color: var(--dark); font-weight: 700; margin-bottom: 5px; }
.auth-header p { color: var(--text-light); margin-bottom: 30px; }

.form-group { margin-bottom: 20px; text-align: left; }
.form-group label { display: block; margin-bottom: 8px; color: var(--dark); font-weight: 600; font-size: 0.95em; }
.form-group input {
    width: 100%; padding: 14px 16px; border: 2px solid var(--border);
    border-radius: 12px; font-size: 1em; transition: all 0.2s ease;
    background: #f8fafc; color: var(--dark);
}
.form-group input:focus { outline: none; border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1); }

.auth-btn {
    width: 100%; padding: 16px; background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white; border: none; border-radius: 12px; font-size: 1.1em; font-weight: 600;
    cursor: pointer; transition: transform 0.2s, box-shadow 0.2s; margin-top: 10px;
}
.auth-btn:hover { transform: translateY(-2px); box-shadow: 0 10px 20px -5px rgba(79, 70, 229, 0.4); }

.auth-footer { margin-top: 25px; color: var(--text-light); font-size: 0.95em; }
.auth-footer a { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-footer a:hover { text-decoration: underline; }

/* --- Dashboard Layout --- */
.dashboard-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: #ffffff;
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; height: 100vh;
    z-index: 100;
}

.sidebar-header {
    height: 80px; display: flex; align-items: center; justify-content: center;
    border-bottom: 1px solid var(--border);
}
.logo-area { font-size: 1.5em; font-weight: 800; color: var(--primary); display: flex; align-items: center; gap: 10px; }

.sidebar-nav { padding: 20px; flex: 1; overflow-y: auto; }
.sidebar-nav a {
    display: flex; align-items: center; padding: 14px 16px;
    color: var(--text-light); text-decoration: none;
    border-radius: 12px; margin-bottom: 8px; font-weight: 500;
    transition: all 0.2s;
}
.sidebar-nav a i { width: 24px; margin-right: 12px; font-size: 1.1em; }
.sidebar-nav a:hover, .sidebar-nav a.active {
    background: #eef2ff; color: var(--primary);
}
.sidebar-nav a.active { font-weight: 600; }

.sidebar-footer { padding: 20px; border-top: 1px solid var(--border); }
.logout-btn {
    display: flex; align-items: center; justify-content: center;
    width: 100%; padding: 12px; border-radius: 12px;
    background: #fee2e2; color: var(--danger);
    text-decoration: none; font-weight: 600; transition: 0.2s;
}
.logout-btn:hover { background: #fecaca; }

/* Main Content */
.main-content {
    flex: 1; margin-left: var(--sidebar-width); padding: 40px;
    background: var(--bg-body);
}

.main-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 40px; padding-bottom: 20px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}
.welcome-text h1 { font-size: 1.8em; color: var(--dark); margin-bottom: 5px; }
.welcome-text p { color: var(--text-light); }

.wallet-badge {
    background: #fff; padding: 10px 20px; border-radius: 50px;
    display: flex; align-items: center; gap: 10px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border);
    font-weight: 700; color: var(--dark);
}
.wallet-icon {
    width: 32px; height: 32px; background: #fef3c7; color: var(--accent);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
}

/* Sections */
.section-card { margin-bottom: 50px; animation: fadeUp 0.5s ease; }
.section-title {
    font-size: 1.4em; color: var(--dark); margin-bottom: 20px;
    display: flex; align-items: center; gap: 10px;
}
.section-title i { color: var(--primary); }

.cards-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 25px;
}

/* App Cards */
.card {
    background: var(--bg-card); border-radius: var(--radius);
    padding: 25px; border: 1px solid var(--border);
    box-shadow: var(--shadow-sm); transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative; display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lg); border-color: var(--primary-light); }

.card-header { font-size: 1.25em; font-weight: 700; color: var(--dark); margin-bottom: 15px; display: flex; justify-content: space-between; align-items: flex-start; }
.card-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.5em; margin-bottom: 15px; }

/* Status Styles */
.active-card .card-icon { background: #ecfdf5; color: var(--secondary); }
.expired-card .card-icon { background: #fef2f2; color: var(--danger); }
.available-card .card-icon { background: #eef2ff; color: var(--primary); }

.card-body { flex: 1; color: var(--text-light); font-size: 0.95em; margin-bottom: 20px; }
.info-row { display: flex; justify-content: space-between; margin-bottom: 8px; border-bottom: 1px dashed #f1f5f9; padding-bottom: 8px; }
.info-row:last-child { border: none; }
.info-label { font-weight: 500; }
.info-value { font-weight: 600; color: var(--dark); }

.badge-version { background: #f3f4f6; color: var(--text-main); padding: 2px 8px; border-radius: 6px; font-size: 0.85em; font-weight: 600; border: 1px solid #e5e7eb; }

.card-footer { display: flex; gap: 10px; margin-top: auto; }
.btn {
    flex: 1; padding: 10px; border-radius: 10px; border: none; font-weight: 600;
    cursor: pointer; text-align: center; text-decoration: none; transition: 0.2s;
    font-size: 0.95em; display: flex; align-items: center; justify-content: center; gap: 6px;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--secondary); color: white; }
.btn-success:hover { background: #059669; }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text-main); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: #fff; }
.btn-danger { background: #ffe4e6; color: var(--danger); }
.btn-danger:hover { background: #fecdd3; }

/* Empty State */
.empty-state {
    text-align: center; padding: 40px; background: #fff; border-radius: var(--radius);
    border: 2px dashed var(--border); color: var(--text-light);
}
.empty-state i { font-size: 3em; color: #cbd5e1; margin-bottom: 15px; display: block; }

/* --- Admin Table (Dep123) --- */
.table-container { background: white; border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
th { background: #f8fafc; text-align: left; padding: 16px; font-weight: 600; color: var(--text-light); border-bottom: 1px solid var(--border); }
td { padding: 16px; border-bottom: 1px solid var(--border); color: var(--text-main); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }
.search-bar form { display: flex; gap: 10px; margin-bottom: 20px; }
.search-bar input { flex: 1; max-width: 400px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; }

/* --- Modal --- */
#purchase-modal {
    display: none; position: fixed; inset: 0; z-index: 1000;
    align-items: center; justify-content: center; backdrop-filter: blur(4px);
}
#purchase-modal.show { display: flex; }
.modal-overlay { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.6); }
.modal-content {
    position: relative; background: #fff; width: 90%; max-width: 500px;
    border-radius: 24px; padding: 30px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: zoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h2 { font-size: 1.5em; color: var(--dark); }
.close-btn { font-size: 1.5em; cursor: pointer; color: var(--text-light); transition: 0.2s; }
.close-btn:hover { color: var(--danger); transform: rotate(90deg); }
.days-input { 
    width: 100%; font-size: 2em; font-weight: 700; color: var(--primary); text-align: center;
    border: none; background: #f1f5f9; border-radius: 16px; padding: 20px; margin: 15px 0;
}
.days-input:focus { outline: 2px solid var(--primary); background: #fff; }
.cost-display { text-align: center; font-size: 1.1em; color: var(--text-light); margin-bottom: 25px; }
.cost-display span { color: var(--accent); font-weight: 700; font-size: 1.2em; }

/* Toast */
.toast-notification {
    position: fixed; top: 20px; right: 20px; background: #fff; padding: 16px 24px;
    border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 9999;
    display: flex; align-items: center; gap: 12px; font-weight: 500;
    transform: translateX(120%); transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
.toast-notification.show { transform: translateX(0); }
.toast-notification.success { border-left: 4px solid var(--secondary); color: #065f46; }
.toast-notification.success i { color: var(--secondary); }
.toast-notification.error { border-left: 4px solid var(--danger); color: #991b1b; }
.toast-notification.error i { color: var(--danger); }

/* Animation Keyframes */
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes zoomIn { from { opacity: 0; transform: scale(0.9); } to { opacity: 1; transform: scale(1); } }

/* Update Progress */
.update-info-box { background: #f8fafc; border: 1px solid var(--border); padding: 15px; border-radius: 12px; margin-top: 15px; font-size: 0.95em; }
.update-progress-container { height: 10px; background: #e2e8f0; border-radius: 5px; overflow: hidden; margin: 15px 0; display: none; }
.update-progress-bar { height: 100%; background: var(--secondary); width: 0; transition: width 0.3s; }

/* Responsive */
@media (max-width: 1024px) {
    .sidebar { width: 80px; }
    .sidebar-header h2, .sidebar-nav span { display: none; }
    .sidebar-nav a { justify-content: center; padding: 15px; }
    .sidebar-nav a i { margin: 0; font-size: 1.4em; }
    .main-content { margin-left: 80px; padding: 20px; }
}
@media (max-width: 768px) {
    .dashboard-wrapper { flex-direction: column; }
    .sidebar { position: fixed; bottom: 0; top: auto; width: 100%; height: auto; flex-direction: row; border-top: 1px solid var(--border); border-right: none; padding: 0; z-index: 999; }
    .sidebar-header, .sidebar-footer { display: none; }
    .sidebar-nav { display: flex; justify-content: space-around; padding: 10px; }
    .sidebar-nav a { margin: 0; background: transparent; color: var(--text-light); flex-direction: column; font-size: 0.8em; gap: 5px; }
    .sidebar-nav a i { font-size: 1.4em; }
    .sidebar-nav a.active { color: var(--primary); background: transparent; }
    .main-content { margin-left: 0; margin-bottom: 70px; }
    .cards-grid { grid-template-columns: 1fr; }
}
/* Thêm vào cuối file style.css */

/* Nút icon nhỏ dùng cho kiểm tra cập nhật cạnh version */
.btn-icon-small {
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 1em;
    padding: 0 8px;
    transition: all 0.3s ease;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-small:hover {
    background-color: #eef2ff;
    transform: rotate(180deg); /* Hiệu ứng xoay khi di chuột vào */
    color: var(--primary-dark);
}

/* Căn chỉnh dòng chứa version */
.version-row {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 8px; /* Giữ khoảng cách giống thẻ p cũ */
}

.form-group img {
    height: 48px;
    cursor: pointer;
}
.form-group button i {
    font-size: 1.2em;
    transition: transform 0.3s;
}
.form-group button:hover i {
    transform: rotate(180deg);
}