/* ===================== Base ===================== */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: #f4f6fa;
    color: #222;
}
a { color: #2657ff; text-decoration: none; }
a:hover { text-decoration: underline; }

.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}
.btn-primary { background: #2657ff; color: #fff; }
.btn-primary:hover { background: #1a3fcc; text-decoration: none; }
.btn-secondary { background: #eee; color: #222; }
.btn-danger { background: #e04b4b; color: #fff; }
.btn-small { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; }

/* ===================== Auth pages ===================== */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #2657ff, #6c8dff);
}
.auth-box {
    background: #fff;
    padding: 40px;
    border-radius: 12px;
    width: 380px;
    box-shadow: 0 10px 30px rgba(0,0,0,.2);
}
.auth-box h2 { margin-bottom: 20px; }
.auth-box label { display: block; margin: 12px 0 4px; font-size: 13px; font-weight: 600; }
.auth-box input {
    width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 14px;
}
.auth-box button { margin-top: 20px; }
.auth-box p { margin-top: 14px; font-size: 13px; }
.muted { color: #888; font-size: 12px; }

.alert { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 13px; }
.alert-error { background: #fdecea; color: #b3261e; }
.alert-success { background: #e6f7ec; color: #1e7a3a; }

/* ===================== Top Navbar ===================== */
.navbar {
    display: flex; justify-content: space-between; align-items: center;
    background: #fff; padding: 14px 30px; box-shadow: 0 2px 6px rgba(0,0,0,.06);
}
.navbar .brand { font-weight: 800; font-size: 20px; color: #2657ff; }
.navbar .nav-links a { margin-left: 20px; font-size: 14px; color: #333; }

/* ===================== Dashboard ===================== */
.container { max-width: 1100px; margin: 0 auto; padding: 30px 20px; }
.page-title { font-size: 24px; margin-bottom: 6px; }
.page-sub { color: #666; margin-bottom: 24px; }

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 18px;
}
.resume-card {
    background: #fff; border-radius: 10px; padding: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.resume-card .thumb {
    height: 140px; background: #eef1fb; border-radius: 6px; margin-bottom: 10px;
    display: flex; align-items: center; justify-content: center; color: #99a3c9; font-size: 12px;
}
.resume-card h4 { font-size: 15px; margin-bottom: 4px; }
.resume-card .meta { font-size: 12px; color: #888; margin-bottom: 10px; }
.resume-card .actions { display: flex; gap: 6px; flex-wrap: wrap; }

.plan-banner {
    background: #fff9e6; border: 1px solid #ffe08a; padding: 14px 18px; border-radius: 8px;
    margin-bottom: 24px; font-size: 14px; display: flex; justify-content: space-between; align-items: center;
}

/* ===================== Builder ===================== */
.builder-wrap {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
    align-items: start;
    padding: 20px;
}
.builder-form {
    background: #fff; border-radius: 10px; padding: 20px;
    max-height: 88vh; overflow-y: auto; box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.builder-form h3 { margin: 16px 0 8px; font-size: 15px; color: #2657ff; }
.builder-form h3:first-child { margin-top: 0; }
.builder-form label { display: block; font-size: 12px; font-weight: 600; margin: 8px 0 3px; }
.builder-form input, .builder-form textarea, .builder-form select {
    width: 100%; padding: 8px; border: 1px solid #ddd; border-radius: 5px; font-size: 13px;
}
.repeat-block { border: 1px dashed #ccc; padding: 10px; border-radius: 6px; margin-bottom: 10px; position: relative; }
.repeat-block .remove-btn {
    position: absolute; top: 6px; right: 6px; background: #e04b4b; color: #fff;
    border: none; border-radius: 4px; font-size: 11px; padding: 2px 8px; cursor: pointer;
}
.add-btn { background: #eef1fb; color: #2657ff; border: none; padding: 8px; border-radius: 6px; width: 100%; cursor: pointer; font-size: 13px; margin-top: 4px; }

.custom-field-row { display: flex; gap: 6px; margin-bottom: 6px; }
.custom-field-row input { flex: 1; }

.template-gallery { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.template-thumb {
    min-width: 70px; height: 90px; background: #eef1fb; border-radius: 6px; cursor: pointer;
    border: 2px solid transparent; display: flex; align-items: center; justify-content: center;
    font-size: 10px; text-align: center; color: #556; padding: 4px;
}
.template-thumb.active { border-color: #2657ff; background: #dfe6ff; }
.template-thumb.locked { opacity: .55; }
.lock-badge { font-size: 9px; color: #b3261e; display: block; }

.preview-panel {
    background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.preview-actions { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
#resumePreview {
    border: 1px solid #ddd; min-height: 700px; padding: 0; overflow: hidden;
    display: flex; justify-content: center;
}

/* ===================== Resume templates common wrapper ===================== */
.resume-doc {
    width: 794px; min-height: 1123px; background: #fff; padding: 40px;
    font-family: 'Georgia', serif; color: #222; font-size: 13px;
}
.resume-doc h1 { font-size: 26px; margin-bottom: 2px; }
.resume-doc h2 { font-size: 15px; text-transform: uppercase; letter-spacing: 1px; margin: 18px 0 8px; border-bottom: 2px solid #2657ff; padding-bottom: 4px; }
.resume-doc .contact-line { font-size: 12px; color: #555; margin-bottom: 10px; }
.resume-doc .entry { margin-bottom: 10px; }
.resume-doc .entry .title-row { display: flex; justify-content: space-between; font-weight: bold; }
.resume-doc .photo {
    width: 110px; height: 130px; object-fit: cover; border-radius: 6px; background: #eee;
}
.resume-doc .tag { display: inline-block; background: #eef1fb; color: #2657ff; padding: 3px 10px; border-radius: 12px; font-size: 11px; margin: 2px; }

@media print {
    body * { visibility: hidden; }
    #resumePreview, #resumePreview * { visibility: visible; }
    #resumePreview { position: absolute; left: 0; top: 0; }
}

/* ===================== Admin ===================== */
.admin-layout { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.admin-sidebar { background: #1b2338; color: #fff; padding: 20px 0; }
.admin-sidebar .brand { padding: 0 20px 20px; font-weight: 800; font-size: 18px; }
.admin-sidebar a { display: block; padding: 12px 20px; color: #cdd3ea; font-size: 14px; }
.admin-sidebar a:hover, .admin-sidebar a.active { background: #2657ff; color: #fff; text-decoration: none; }
.admin-main { padding: 30px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 30px; }
.stat-card { background: #fff; padding: 20px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.stat-card .num { font-size: 28px; font-weight: 800; color: #2657ff; }
.stat-card .label { font-size: 13px; color: #666; }

table.admin-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 10px; overflow: hidden; }
table.admin-table th, table.admin-table td { padding: 12px 14px; text-align: left; font-size: 13px; border-bottom: 1px solid #eee; }
table.admin-table th { background: #f7f8fc; }
.badge { padding: 3px 10px; border-radius: 10px; font-size: 11px; }
.badge-free { background: #eef1fb; color: #2657ff; }
.badge-paid { background: #fff2cc; color: #a8710a; }
.badge-active { background: #e6f7ec; color: #1e7a3a; }
.badge-blocked { background: #fdecea; color: #b3261e; }
