:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --primary-light: rgba(59, 132, 246, 0.15);
    --secondary-color: #64748b;
    --bg-app: #f8fafc;
    --bg-card: #ffffff;
    --bg-input: #f1f5f9;
    --text-primary: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    
    --radius-sm: 8px;
    --radius-xs: 6px;
    
    --status-open: #10b981;
    --status-closed: #ef4444;
    --status-selected: #3b82f6;
    --status-pending: #f59e0b;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #e0eafc 0%, #cfdef3 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    padding-bottom: 70px; /* Space for bottom nav bar */
}

/* App Views Toggle */
body.show-login .app-container,
body.show-login .bottom-nav {
    display: none !important;
}

body.show-app .login-container {
    display: none !important;
}

body.show-app .app-container {
    display: block !important;
}

body.show-app .bottom-nav {
    display: flex !important;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
}

/* --- Login View styling --- */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 1.25rem;
    background: linear-gradient(135deg, #e0eafc 0%, #cfdef3 100%);
}

.login-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 2rem 1.5rem;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
    text-align: center;
}

.login-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.login-card h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.login-card p {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

/* --- Layout Elements --- */
.app-container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.app-header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-logo {
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    line-height: 1.2;
}

.brand-subtitle {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 600;
}

.btn-logout {
    background: none;
    border: none;
    color: #ef4444;
    font-size: 1.15rem;
    cursor: pointer;
    padding: 0.35rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Scroll Panel --- */
.page-scroll-container {
    padding: 0.75rem 0.75rem 2rem;
}

.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 1rem;
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05), 0 2px 8px -1px rgba(15, 23, 42, 0.03);
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

@media (max-width: 480px) {
    .grid-2 {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
}

.form-group {
    margin-bottom: 0.75rem;
}

label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    display: block;
}

input, select, textarea {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xs);
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--text-primary);
    background-color: var(--bg-input);
    outline: none;
    transition: border-color 0.2s, background-color 0.2s;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary-color);
    background-color: var(--bg-card);
}

/* Icons in Inputs */
.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    top: 50%;
    left: 0.75rem;
    transform: translateY(-50%);
    font-size: 0.88rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-family: inherit;
    font-weight: 600;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    font-size: 0.88rem;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--bg-input);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
}

.btn-whatsapp {
    background-color: #10b981;
    color: white;
}

.btn-whatsapp:hover {
    background-color: #059669;
}

/* --- Dashboard Specific --- */
.profile-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.85rem;
    margin-bottom: 1rem;
}

.avatar-container {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
}

.default-avatar {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.profile-title h2 {
    font-size: 1.1rem;
    color: var(--text-primary);
}

.status-badge {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 10px;
}

.status-badge.pending {
    background-color: rgba(245, 158, 11, 0.15);
    color: #d97706;
}

.status-badge.verified {
    background-color: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1rem;
}

@media (max-width: 480px) {
    .profile-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
}

.profile-item {
    display: flex;
    flex-direction: column;
}

.item-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.item-value {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-secondary);
}

/* --- Ads Slot styling --- */
.ad-slot-container {
    width: 100%;
    margin-bottom: 0.5rem;
}

.sponsored-ad-card {
    width: 100%;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    color: #ffffff;
    border-radius: 10px;
    padding: 0.85rem 1rem;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
    border: 1px solid #334155;
    margin-bottom: 0.75rem;
    text-align: left;
}

.sponsored-ad-card::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.25) 0%, rgba(59, 130, 246, 0) 70%);
    border-radius: 50%;
}

.sponsored-badge {
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.15);
    color: #94a3b8;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.5px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ad-content-flex {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ad-icon-circle {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #06b6d4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: #ffffff;
    flex-shrink: 0;
}

.ad-text-body {
    flex: 1;
}

.ad-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: #f8fafc;
    margin-bottom: 2px;
}

.ad-subtitle {
    font-size: 0.75rem;
    color: #cbd5e1;
    line-height: 1.35;
}

.ad-btn-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #22c55e;
    color: #ffffff;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 20px;
    margin-top: 5px;
    text-decoration: none;
    box-shadow: 0 2px 6px rgba(34, 197, 94, 0.3);
}

.ad-placeholder {
    width: 100%;
    height: 90px;
    border: 1px dashed #cbd5e1;
    border-radius: var(--radius-sm);
    background-color: #f8fafc;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    padding: 0.5rem;
}

.ad-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    background-color: #e2e8f0;
    color: #64748b;
    padding: 1px 4px;
    border-radius: 4px;
}

/* --- Tuitions List styling --- */
.tuition-card {
    border-top: 4px solid var(--primary-color);
}

.tuition-card.nearby-highlight {
    border-top-color: #10b981;
    background-color: rgba(16, 185, 129, 0.02);
}

.nearby-tag {
    background-color: #10b981;
    color: white;
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.15rem 0.45rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
}

.tuition-row {
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
    color: var(--text-secondary);
}

.tuition-row strong {
    color: var(--text-primary);
}

.requirements-box {
    margin-top: 0.5rem;
    padding: 0.5rem;
    background-color: var(--bg-app);
    border-radius: var(--radius-xs);
    border: 1px solid var(--border-color);
    font-size: 0.82rem;
}

/* --- Bottom Nav Dock --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background-color: var(--bg-card);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 200;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.03);
}

.nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-family: inherit;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 600;
    width: 30%;
    height: 100%;
    gap: 0.2rem;
}

.nav-item i {
    font-size: 1.15rem;
}

.nav-item.active {
    color: var(--primary-color);
}

/* --- Modals --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(15, 23, 42, 0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 500;
    padding: 1rem;
}

.modal.show {
    display: flex;
}

.modal-content {
    background-color: var(--bg-card);
    border-radius: var(--radius-sm);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.modal-header {
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: 1.05rem;
    color: var(--text-primary);
}

.btn-close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* Toast System */
#toast-container {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 90%;
    max-width: 320px;
}

.toast {
    background-color: #1e293b;
    color: white;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-xs);
    font-size: 0.82rem;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: fadeInDown 0.2s ease;
}

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

.toast.success { border-left: 4px solid #10b981; }
.toast.error { border-left: 4px solid #ef4444; }
.toast.info { border-left: 4px solid #3b82f6; }

/* Success Msg Form Overlay */
.success-msg {
    text-align: center;
    padding: 2rem 1rem;
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Sticky Ad Container Styling */
#tab-dashboard .sticky-ad {
    position: sticky;
    top: 57px; /* Stick right below the header (header is 60px height minus tiny overlap border) */
    z-index: 90;
    background: linear-gradient(135deg, #e0eafc 0%, #cfdef3 100%);
    background-attachment: fixed;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    margin-top: -0.75rem; /* Negate container padding */
    margin-left: -0.75rem;
    margin-right: -0.75rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

/* Compact Professional cv-maker Form Styling */
#tab-make-cv .card {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin-bottom: 1rem !important;
}

#tab-make-cv .card > div:first-of-type {
    margin-bottom: 0.65rem !important;
    padding-bottom: 0.4rem !important;
}

#tab-make-cv .card h2 {
    font-size: 1.1rem !important;
}

#tab-make-cv .form-group {
    margin-bottom: 0 !important;
}

#tab-make-cv label {
    font-size: 0.76rem !important;
    font-weight: 600 !important;
    color: var(--text-secondary) !important;
    margin-bottom: 0.15rem !important;
}

#tab-make-cv input,
#tab-make-cv select {
    padding: 0.35rem 0.5rem !important;
    font-size: 0.82rem !important;
    border-radius: 4px !important;
    border: 1px solid #cbd5e1 !important;
    background-color: #ffffff !important;
    height: auto !important;
}

#tab-make-cv .grid-2 {
    gap: 0.35rem 0.5rem !important;
    margin-top: 0.35rem !important;
}

@media (max-width: 480px) {
    #tab-make-cv .grid-2 {
        grid-template-columns: 1fr !important;
        row-gap: 0.25rem !important;
    }
}

#tab-make-cv .sub-group {
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

#tab-make-cv .sub-group label {
    color: #1e293b !important;
    font-weight: 700 !important;
    margin-bottom: 0.2rem !important;
}

#tab-make-cv .sub-group input,
#tab-make-cv .sub-group select {
    margin-bottom: 0.25rem !important;
}

/* --- Reference Selection Modal Styling --- */
.ref-card-list {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.ref-option-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0.95rem;
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    user-select: none;
}

.ref-option-card:hover, .ref-option-card:active {
    border-color: #25D366;
    background-color: #f0fdf4;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.15);
}

.ref-info-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ref-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(37, 211, 102, 0.25);
}

.ref-details {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.ref-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
}

.ref-phone {
    font-size: 0.82rem;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-weight: 500;
}

.ref-phone i {
    color: #25D366;
}

.ref-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background-color: #25D366;
    color: white;
    font-size: 0.78rem;
    font-weight: 600;
    padding: 0.4rem 0.75rem;
    border-radius: 6px;
    border: none;
    transition: background-color 0.2s;
    pointer-events: none;
}

.ref-option-card:hover .ref-action-btn {
    background-color: #1eb857;
}

.ref-instruction-box {
    margin-top: 0.85rem;
    background-color: #fffbeb;
    border: 1px solid #fde68a;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    padding: 0.65rem 0.8rem;
    font-size: 0.8rem;
    color: #92400e;
    line-height: 1.45;
}

/* --- Google AdMob Integration Styling --- */
ins.adsbygoogle {
    background: transparent !important;
    margin: 0 auto;
}

/* When Google AdMob serves a live ad, automatically hide the placeholder/fallback card */
ins.adsbygoogle[data-ad-status="filled"] + .fallback-ad-card,
ins.adsbygoogle[data-ad-status="filled"] ~ .fallback-ad-card {
    display: none !important;
}

