/* ==========================================
   KHOA TOOL - Frontend stylesheet
   ========================================== */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --accent: #06b6d4;
    --bg: #ffffff;
    --bg-soft: #f8fafc;
    --bg-dark: #0f172a;
    --text: #0f172a;
    --text-soft: #475569;
    --border: #e2e8f0;
    --success: #16a34a;
    --danger: #dc2626;
    --warning: #f59e0b;
    --radius: 10px;
    --shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
    --shadow-hover: 0 10px 30px rgba(15, 23, 42, 0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, 'Roboto', Arial, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    font-size: 16px;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--primary); text-decoration: none; transition: color .15s; }
a:hover { color: var(--primary-dark); }

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

/* ===== Header ===== */
.site-header {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.site-header .inner {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 0;
}
.logo {
    font-size: 22px; font-weight: 800; color: var(--primary);
    display: flex; align-items: center; gap: 8px;
}
.logo span { color: var(--text); }
.main-nav ul {
    display: flex; gap: 28px; list-style: none;
}
.main-nav a {
    color: var(--text); font-weight: 500; padding: 6px 0;
    position: relative;
}
.main-nav a:hover, .main-nav a.active {
    color: var(--primary);
}
.main-nav a.active::after {
    content: ''; position: absolute; left: 0; right: 0; bottom: -16px;
    height: 2px; background: var(--primary);
}
.header-cta { display: flex; gap: 10px; align-items: center; }
.menu-toggle {
    display: none; background: none; border: 0; font-size: 24px; cursor: pointer;
}

/* ===== Buttons ===== */
.btn {
    display: inline-block; padding: 10px 22px;
    border-radius: var(--radius); border: 0; cursor: pointer;
    font-weight: 600; font-size: 15px; transition: all .15s;
    text-align: center;
}
.btn-primary {
    background: var(--primary); color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); color: #fff; transform: translateY(-1px); }
.btn-outline {
    background: transparent; color: var(--primary); border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; color: #fff; }
.btn-ghost { background: var(--bg-soft); color: var(--text); }
.btn-sm { padding: 6px 14px; font-size: 13px; }
.btn-lg { padding: 14px 30px; font-size: 17px; }
.btn-block { display: block; width: 100%; }

/* ===== Hero ===== */
.hero {
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #06b6d4 100%);
    color: #fff; padding: 80px 0 100px;
    position: relative; overflow: hidden;
}
.hero::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(circle at 30% 20%, rgba(255,255,255,.15), transparent 50%);
    pointer-events: none;
}
.hero .container { position: relative; z-index: 2; }
.hero h1 {
    font-size: 44px; line-height: 1.2; margin-bottom: 16px;
    font-weight: 800;
}
.hero .lead { font-size: 19px; opacity: .92; max-width: 680px; margin-bottom: 32px; }
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-actions .btn-outline {
    background: rgba(255,255,255,.1); color: #fff; border-color: #fff;
}
.hero-actions .btn-outline:hover { background: #fff; color: var(--primary); }
.hero-stats {
    display: flex; gap: 40px; margin-top: 48px; flex-wrap: wrap;
}
.hero-stats .stat strong {
    display: block; font-size: 32px; font-weight: 800;
}
.hero-stats .stat span { opacity: .85; font-size: 14px; }

/* ===== Sections ===== */
.section { padding: 70px 0; }
.section-soft { background: var(--bg-soft); }
.section-head { text-align: center; margin-bottom: 48px; }
.section-head h2 {
    font-size: 32px; font-weight: 800; margin-bottom: 10px;
}
.section-head p { color: var(--text-soft); font-size: 17px; }

/* ===== Product cards ===== */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
}
.product-card {
    background: #fff; border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden;
    transition: all .2s; display: flex; flex-direction: column;
}
.product-card:hover {
    transform: translateY(-4px); box-shadow: var(--shadow-hover);
    border-color: var(--primary);
}
.product-card .thumb {
    height: 180px; background: linear-gradient(135deg, #2563eb, #06b6d4);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 48px; font-weight: 800;
}
.product-card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-card .body { padding: 18px; flex: 1; display: flex; flex-direction: column; }
.product-card h3 {
    font-size: 18px; font-weight: 700; margin-bottom: 8px;
}
.product-card h3 a { color: var(--text); }
.product-card h3 a:hover { color: var(--primary); }
.product-card .desc {
    color: var(--text-soft); font-size: 14px; flex: 1; margin-bottom: 14px;
}
.product-card .price {
    display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px;
}
.product-card .price .new {
    color: var(--danger); font-size: 20px; font-weight: 800;
}
.product-card .price .old {
    color: var(--text-soft); font-size: 14px; text-decoration: line-through;
}
.product-card .meta {
    display: flex; gap: 12px; font-size: 12px; color: var(--text-soft);
    margin-bottom: 14px;
}
.product-card .meta span { display: inline-flex; align-items: center; gap: 4px; }

/* ===== Feature list (sao chép layout 3 cột) ===== */
.feature-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 28px;
}
.feature-card {
    text-align: center; padding: 28px 22px;
    background: #fff; border-radius: var(--radius); border: 1px solid var(--border);
}
.feature-card .icon {
    width: 60px; height: 60px; border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff; display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px; font-size: 26px;
}
.feature-card h3 { font-size: 18px; margin-bottom: 8px; }
.feature-card p { color: var(--text-soft); font-size: 14px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; margin-bottom: 6px; font-weight: 600; font-size: 14px;
}
.form-control {
    width: 100%; padding: 11px 14px; border: 1px solid var(--border);
    border-radius: 8px; font-size: 15px; font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
    outline: 0; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
textarea.form-control { resize: vertical; min-height: 120px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-help { font-size: 12px; color: var(--text-soft); margin-top: 4px; }

/* ===== Alerts ===== */
.alert {
    padding: 12px 16px; border-radius: 8px; margin-bottom: 16px;
    border-left: 4px solid;
}
.alert-success { background: #f0fdf4; border-color: var(--success); color: #166534; }
.alert-error   { background: #fef2f2; border-color: var(--danger);  color: #991b1b; }
.alert-info    { background: #eff6ff; border-color: var(--primary); color: #1e40af; }

/* ===== Detail page ===== */
.product-detail {
    display: grid; grid-template-columns: 1fr 1fr; gap: 40px;
    margin-bottom: 50px;
}
.product-detail .gallery {
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    border-radius: var(--radius); min-height: 360px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 80px; font-weight: 800;
}
.product-detail h1 { font-size: 32px; margin-bottom: 12px; }
.product-detail .price-box {
    background: var(--bg-soft); padding: 18px; border-radius: var(--radius);
    margin: 18px 0;
}
.product-detail .price-box .new { color: var(--danger); font-size: 28px; font-weight: 800; }
.product-detail .price-box .old { color: var(--text-soft); font-size: 16px; text-decoration: line-through; margin-left: 8px; }
.product-detail .features-list {
    list-style: none; margin: 18px 0;
}
.product-detail .features-list li {
    padding: 6px 0 6px 28px; position: relative;
}
.product-detail .features-list li::before {
    content: '✓'; position: absolute; left: 0; color: var(--success);
    font-weight: 800;
}
.product-detail .actions { display: flex; gap: 12px; margin-top: 20px; }

.tabs { border-bottom: 2px solid var(--border); margin-bottom: 24px; display: flex; gap: 6px; }
.tabs button {
    padding: 12px 22px; background: none; border: 0; cursor: pointer;
    font-weight: 600; color: var(--text-soft); border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}
.tabs button.active { color: var(--primary); border-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ===== Tables (admin/user dashboard) ===== */
.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); border: 1px solid var(--border); }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td {
    padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--border);
}
table.data th { background: var(--bg-soft); font-weight: 700; font-size: 13px; }
table.data tr:last-child td { border-bottom: 0; }

.badge {
    display: inline-block; padding: 3px 10px; border-radius: 99px;
    font-size: 12px; font-weight: 600;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-info    { background: #dbeafe; color: #1e40af; }
.badge-gray    { background: #e5e7eb; color: #374151; }

/* ===== Footer ===== */
.site-footer {
    background: var(--bg-dark); color: #cbd5e1; padding: 60px 0 24px;
    margin-top: 60px;
}
.footer-grid {
    display: grid; grid-template-columns: 1.5fr 1fr 1fr 1fr; gap: 40px;
    margin-bottom: 40px;
}
.site-footer h4 { color: #fff; font-size: 16px; margin-bottom: 16px; }
.site-footer ul { list-style: none; }
.site-footer ul li { margin-bottom: 8px; }
.site-footer a { color: #cbd5e1; }
.site-footer a:hover { color: #fff; }
.footer-bottom {
    border-top: 1px solid #1e293b; padding-top: 20px;
    text-align: center; font-size: 14px; color: #94a3b8;
}

/* ===== Page heading ===== */
.page-head {
    background: var(--bg-soft); padding: 50px 0; border-bottom: 1px solid var(--border);
    margin-bottom: 50px;
}
.page-head h1 { font-size: 32px; margin-bottom: 6px; }
.breadcrumb { font-size: 14px; color: var(--text-soft); }
.breadcrumb a { color: var(--primary); }

/* ===== Auth box ===== */
.auth-box {
    max-width: 440px; margin: 60px auto; background: #fff;
    padding: 36px; border-radius: var(--radius); box-shadow: var(--shadow);
    border: 1px solid var(--border);
}
.auth-box h1 { font-size: 24px; margin-bottom: 6px; text-align: center; }
.auth-box .sub { text-align: center; color: var(--text-soft); margin-bottom: 24px; }
.auth-box .alt { text-align: center; margin-top: 16px; font-size: 14px; }

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .hero h1 { font-size: 32px; }
    .hero .lead { font-size: 16px; }
    .product-detail { grid-template-columns: 1fr; }
    .footer-grid { grid-template-columns: 1fr 1fr; }
    .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
    .menu-toggle { display: block; }
    .main-nav {
        position: absolute; top: 100%; left: 0; right: 0; background: #fff;
        border-bottom: 1px solid var(--border); display: none;
    }
    .main-nav.open { display: block; }
    .main-nav ul {
        flex-direction: column; gap: 0; padding: 12px 20px;
    }
    .main-nav li {
        border-bottom: 1px solid var(--border); padding: 10px 0;
    }
    .main-nav a.active::after { display: none; }
    .header-cta .btn:not(.btn-primary) { display: none; }
    .footer-grid { grid-template-columns: 1fr; gap: 28px; }
    .section { padding: 50px 0; }
    .section-head h2 { font-size: 26px; }
}
