@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --background: #ffffff;
    --foreground: #212121;
    --primary: #c2410c;
    --primary-foreground: #ffffff;
    --secondary: #f5f5f5;
    --muted: #f5f5f5;
    --muted-foreground: #737373;
    --border: #d9d9d9;
    --destructive: #ef4444;
    --destructive-foreground: #ffffff;
    --realme-black: #000000;
    --realme-orange: #c2410c;
    --realme-tangerine: #ff6600;
    --realme-info-bg: #eef2f6;
    --realme-info-border: #cdd6df;
    --realme-error-bg: #fef2f2;
    --realme-error-border: #fecaca;
    --realme-footer-bg: #ff6600;
    --radius: 0.375rem;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--background);
    color: var(--foreground);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { text-decoration: none; }

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ── Header ── */
.realme-header-bar { background-color: var(--realme-black); }
.header-inner {
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.header-logo { height: 2.5rem; }
.agency-logo { height: 3rem; }
.header-orange-line { height: 4px; background-color: var(--realme-orange); }

.nav-bar {
    background-color: var(--secondary);
    border-bottom: 1px solid var(--border);
}
.nav-inner {
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.back-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: 2px solid rgba(33,33,33,0.7);
    color: rgba(33,33,33,0.7);
    font-size: 0.75rem;
}
.nav-back-link {
    color: var(--foreground);
    font-weight: 500;
    font-size: 0.875rem;
}
.nav-back-link:hover { text-decoration: underline; }

.info-bar {
    background-color: var(--secondary);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
}
.info-text {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    line-height: 1.6;
}

/* ── Footer ── */
.realme-footer {
    background-color: var(--realme-footer-bg);
    margin-top: auto;
    padding: 1.25rem 0;
}
.footer-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}
.footer-nav a {
    color: var(--primary-foreground);
    font-weight: 600;
    font-size: 0.875rem;
}
.footer-nav a:hover { text-decoration: underline; }
.lang-switcher {
    margin-left: auto;
    display: flex;
    gap: 0.75rem;
}
.lang-btn { color: var(--primary-foreground); font-weight: 400; opacity: 0.7; }
.lang-btn:hover { opacity: 1; }
.lang-btn.active { font-weight: 700; text-decoration: underline; opacity: 1; }
.footer-hr {
    border: none;
    border-top: 1px solid rgba(255,255,255,0.4);
    margin-bottom: 1rem;
}
.footer-copyright { font-size: 0.75rem; color: var(--primary-foreground); }

/* ── Main content ── */
.main-content { flex: 1; }

/* ── Dashboard container ── */
.dash-container { padding: 2rem 1.5rem; }
.dash-hr {
    border: none;
    border-top: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

/* ── Inline form helper ── */
.inline-form { display: inline; }

/* ── Split layout (login page) ── */
.split-layout {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}
@media (min-width: 768px) {
    .split-layout { flex-direction: row; }
    .split-left { flex: 1; padding-right: 2rem; }
    .split-right { flex: 1; padding-left: 2rem; border-left: 1px solid var(--border); }
}

.page-title { font-size: 1.5rem; font-weight: 300; color: var(--foreground); margin-bottom: 0.75rem; }
.page-title-bold { font-weight: 700; }
.page-subtitle { font-size: 0.875rem; color: var(--muted-foreground); margin-bottom: 2rem; }

/* ── Forms ── */
.form-group { margin-bottom: 1.25rem; }
.floating-label { position: relative; }
.realme-input {
    width: 100%;
    padding: 0.875rem 0.75rem 0.5rem;
    border: 1px solid var(--border);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
    background: var(--background);
    color: var(--foreground);
    border-radius: var(--radius);
    font-family: 'Inter', sans-serif;
}
.realme-input:focus {
    border-color: var(--realme-orange);
    box-shadow: 0 0 0 2px rgba(194, 65, 12, 0.2);
}
.realme-input.bg-secondary { background: var(--secondary); }

/* Info row input (compact) */
.realme-input.info-input {
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
}

.floating-label label {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
    color: var(--muted-foreground);
    pointer-events: none;
    transition: all 0.2s;
}
.floating-label input:focus + label,
.floating-label input:not(:placeholder-shown) + label {
    top: 0.5rem;
    transform: translateY(0);
    font-size: 0.75rem;
}
.error-text { font-size: 0.875rem; color: var(--destructive); margin-top: 0.25rem; }

/* ── Buttons ── */
.realme-btn-primary {
    background-color: var(--realme-orange);
    color: var(--primary-foreground);
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
    border-radius: var(--radius);
    font-family: 'Inter', sans-serif;
}
.realme-btn-primary:hover { background-color: #9a3412; }
.realme-btn-primary img { height: 1.25rem; width: 1.25rem; }

.realme-btn-cancel {
    background-color: rgba(194, 65, 12, 0.12);
    color: var(--realme-orange);
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
    border-radius: var(--radius);
    font-family: 'Inter', sans-serif;
}
.realme-btn-cancel:hover { background-color: rgba(194, 65, 12, 0.2); }

.realme-btn-continue {
    background-color: var(--muted);
    color: var(--foreground);
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
    border-radius: var(--radius);
    font-family: 'Inter', sans-serif;
}
.realme-btn-continue:hover { background-color: rgba(115,115,115,0.2); }

.realme-link {
    color: var(--realme-orange);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    background: none;
    border: none;
    font-size: inherit;
    font-family: 'Inter', sans-serif;
}
.realme-link:hover { text-decoration: underline; }

.btn-sm { padding: 0.5rem 1rem; font-size: 0.875rem; }

.icon-sm {
    width: 1rem;
    height: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.icon-sm svg {
    width: 100%;
    height: 100%;
}

.section-header .icon-sm {
    width: 1.25rem;
    height: 1.25rem;
}

.realme-btn-primary .icon-sm,
.realme-btn-cancel .icon-sm,
.realme-btn-continue .icon-sm {
    width: 0.9rem;
    height: 0.9rem;
}

/* ── Error box ── */
.error-box {
    background-color: var(--realme-error-bg);
    border: 1px solid var(--realme-error-border);
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius);
}
.error-box-title { font-size: 0.875rem; font-weight: 700; }
.error-box-message { font-size: 0.875rem; margin-top: 0.25rem; }

/* Alert box */
.alert-box {
    background-color: var(--realme-info-bg);
    border: 1px solid var(--realme-info-border);
    padding: 1rem;
    margin-bottom: 1.5rem;
    border-radius: var(--radius);
}

/* ── Dashboard Header ── */
.dashboard-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.5rem;
}
.dashboard-title { font-size: 1.5rem; font-weight: 700; }
.dashboard-app-id {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.dashboard-app-id strong { color: var(--foreground); }
.app-id-input {
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.25rem 0.5rem;
    max-width: 280px;
    outline: none;
    font-family: 'Inter', sans-serif;
}
.app-id-input:focus {
    border-color: var(--realme-orange);
    box-shadow: 0 0 0 2px rgba(194, 65, 12, 0.2);
}

.dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}
.user-badge {
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    color: var(--foreground);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--background);
}

/* ── Status bar ── */
.status-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem;
    border-radius: var(--radius);
    background-color: var(--secondary);
    border: 1px solid var(--border);
}
.status-left,
.status-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.status-label { font-size: 0.875rem; font-weight: 600; color: var(--muted-foreground); }
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 1rem;
    border-radius: var(--radius);
    font-weight: 700;
    font-size: 0.875rem;
}
.status-badge .icon-sm,
.btn-approve .icon-sm,
.btn-revoke .icon-sm {
    width: 0.95rem;
    height: 0.95rem;
}
.status-approved { background-color: #dcfce7; color: #166534; border: 1px solid #86efac; }
.status-pending  { background-color: #fef9c3; color: #854d0e; border: 1px solid #fde047; }

.btn-approve {
    display: inline-flex; align-items: center; gap: 0.375rem;
    padding: 0.375rem 1rem; border-radius: var(--radius);
    font-weight: 600; font-size: 0.875rem;
    border: 1px solid #86efac; cursor: pointer;
    transition: background-color 0.2s; font-family: 'Inter', sans-serif;
    background-color: #dcfce7; color: #166534;
}
.btn-approve:hover { background-color: #bbf7d0; }

.btn-revoke {
    display: inline-flex; align-items: center; gap: 0.375rem;
    padding: 0.375rem 1rem; border-radius: var(--radius);
    font-weight: 600; font-size: 0.875rem;
    border: 1px solid rgba(239,68,68,0.3); cursor: pointer;
    transition: background-color 0.2s; font-family: 'Inter', sans-serif;
    background-color: rgba(239,68,68,0.1); color: var(--destructive);
}
.btn-revoke:hover { background-color: rgba(239,68,68,0.2); }

.submitted-text { font-size: 0.75rem; color: var(--muted-foreground); }

/* ── Share link display ── */
.share-link-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.75rem;
    border-radius: var(--radius);
    background-color: rgba(194,65,12,0.05);
    border: 1px solid rgba(194,65,12,0.2);
}
.share-link-label { font-size: 0.75rem; color: var(--muted-foreground); font-weight: 500; }
.share-link-code {
    font-size: 0.75rem;
    background-color: var(--background);
    padding: 0.25rem 0.5rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    color: var(--foreground);
    word-break: break-all;
    flex: 1;
    min-width: 0;
    font-family: monospace;
}

/* ── Section cards ── */
.section-card {
    background-color: var(--secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    margin-bottom: 1.25rem;
    overflow: hidden;
}
.section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background-color: rgba(194,65,12,0.08);
    border-bottom: 1px solid var(--border);
}
.section-header .icon-sm,
.section-header-icon { color: var(--primary); }
.section-header-title { font-size: 1rem; font-weight: 700; }
.section-body { padding: 1.25rem; }

/* ── Personal Info Layout: photo left, fields right ── */
.personal-info-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}
@media (min-width: 768px) {
    .personal-info-layout {
        grid-template-columns: 140px minmax(0, 1fr);
        column-gap: 1.5rem;
        align-items: start;
    }
    .photo-column {
        width: 140px;
        padding-right: 1.5rem;
        border-right: 1px solid var(--border);
    }
    .personal-fields-column {
        min-width: 0;
    }
    .personal-fields-column .info-row {
        flex-direction: row;
        align-items: center;
    }
}

/* ── Photo section ── */
.photo-column {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}
.photo-img {
    width: 7rem;
    height: 9rem;
    object-fit: cover;
    border-radius: var(--radius);
    border: 2px solid var(--border);
}
.photo-placeholder {
    width: 7rem;
    height: 9rem;
    background: var(--muted);
    border-radius: var(--radius);
    border: 2px dashed var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    cursor: pointer;
    transition: border-color 0.2s;
}
.photo-placeholder:hover {
    border-color: var(--primary);
    background: rgba(194,65,12,0.05);
}
.photo-upload-icon { font-size: 2rem; color: var(--muted-foreground); }
.photo-placeholder-text { font-size: 0.625rem; color: var(--muted-foreground); font-weight: 500; }
.photo-label { font-size: 0.75rem; color: var(--muted-foreground); margin-top: 0.375rem; }
.photo-change {
    font-size: 0.625rem;
    color: var(--primary);
    font-weight: 600;
    margin-top: 0.25rem;
    cursor: pointer;
}
.photo-change:hover { text-decoration: underline; }

.photo-container { position: relative; display: inline-block; }
.photo-remove {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    width: 1.5rem;
    height: 1.5rem;
    background: var(--destructive);
    color: var(--destructive-foreground);
    border: none;
    border-radius: 50%;
    font-size: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}
.photo-container:hover .photo-remove { opacity: 1; }

/* ── Info rows (single column — personal fields) ── */
.info-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.375rem 0;
    border-bottom: 1px solid rgba(217,217,217,0.5);
}
.info-row:last-child { border-bottom: none; }
@media (min-width: 640px) {
    .info-row {
        flex-direction: row;
        align-items: center;
    }
}
.info-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--muted-foreground);
    min-width: 180px;
    flex-shrink: 0;
}
.info-value {
    font-size: 0.875rem;
    color: var(--foreground);
}

/* ── 2-column grid for multi-field sections ── */
.fields-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}
@media (min-width: 768px) {
    .fields-grid-2 {
        grid-template-columns: 1fr 1fr;
        column-gap: 2rem;
    }
}

/* ── Notice boxes ── */
.notice-box {
    background-color: var(--realme-info-bg);
    border: 1px solid var(--realme-info-border);
    border-radius: var(--radius);
    padding: 1rem;
    font-size: 0.875rem;
    margin-top: 0.5rem;
    margin-bottom: 1rem;
}
.notice-box strong { display: block; margin-bottom: 0.25rem; }

.warning-box {
    background-color: #fef9c3;
    border: 1px solid #fde047;
    border-radius: var(--radius);
    padding: 1rem;
    font-size: 0.875rem;
}
.warning-box strong { display: block; margin-bottom: 0.25rem; }

/* ── Radio buttons ── */
.radio-group { margin-bottom: 1.5rem; }
.radio-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    margin-bottom: 0.75rem;
}
.radio-label input[type="radio"] { width: 1.25rem; height: 1.25rem; accent-color: var(--primary); }
.radio-label span { font-size: 0.875rem; font-weight: 600; }

/* ── Create account page ── */
.create-title { font-size: 1.875rem; font-weight: 300; color: var(--primary); margin-bottom: 1rem; }
.create-hr { border: none; border-top: 1px solid var(--primary); margin-bottom: 1.5rem; }
.steps-list { font-size: 0.875rem; margin-bottom: 2rem; padding-left: 1.25rem; }
.steps-list li { margin-bottom: 0.25rem; }
.password-rules {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.25rem 2rem;
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    max-width: 500px;
}
.password-rule { display: flex; align-items: center; gap: 0.5rem; }
.password-rule .dot { color: var(--primary); }
.btn-group { display: flex; align-items: center; gap: 0.75rem; margin-top: 1rem; }

/* ── Public status page ── */
.public-container {
    max-width: 700px;
    margin: 0 auto;
    padding: 2rem 1rem;
}
.public-center { text-align: center; margin-bottom: 1.5rem; }
.public-title { font-size: 1.5rem; font-weight: 700; }
.public-app-id { font-size: 0.875rem; color: var(--muted-foreground); margin-top: 0.25rem; }
.public-app-id strong { color: var(--foreground); }
.public-shared { font-size: 0.75rem; color: var(--muted-foreground); margin-top: 0.25rem; }
.public-status-bar { justify-content: center; }

.public-personal-layout {
    display: grid;
    grid-template-columns: 7rem minmax(0, 1fr);
    column-gap: 1.5rem;
    align-items: start;
}
.public-photo-wrap {
    width: 7rem;
    flex-shrink: 0;
}
.public-photo-wrap .photo-img {
    display: block;
    width: 100%;
    height: 9rem;
    object-fit: cover;
    border-radius: var(--radius);
    border: 2px solid var(--border);
}
.public-info-column {
    min-width: 0;
}
.public-info-column .info-row {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.32rem 0;
}
.public-info-column .info-label {
    min-width: 170px;
    flex-shrink: 0;
}
.public-info-column .info-value {
    min-width: 0;
    flex: 1;
    overflow-wrap: anywhere;
}
@media (max-width: 480px) {
    .public-personal-layout {
        grid-template-columns: 5.5rem minmax(0, 1fr);
        column-gap: 0.75rem;
    }
    .public-photo-wrap {
        width: 5.5rem;
    }
    .public-photo-wrap .photo-img {
        height: 7rem;
    }
    .public-info-column .info-label {
        min-width: 118px;
        font-size: 0.75rem;
    }
    .public-info-column .info-value {
        font-size: 0.8125rem;
    }
}

/* ── Not found ── */
.not-found-center { flex: 1; display: flex; align-items: center; justify-content: center; }
.not-found-content { text-align: center; padding: 2rem; }
.not-found-icon {
    width: 4rem; height: 4rem; margin: 0 auto 1rem; border-radius: 50%;
    background-color: rgba(239,68,68,0.1);
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem; color: var(--destructive);
}
.not-found-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.not-found-text { color: var(--muted-foreground); }

/* ── Toast/Flash messages ── */
.flash-message {
    position: fixed; top: 1rem; right: 1rem;
    padding: 1rem 1.5rem; border-radius: var(--radius);
    background-color: var(--foreground); color: var(--background);
    font-size: 0.875rem; font-weight: 500; z-index: 1000;
    animation: fadeInOut 3s ease-in-out; pointer-events: none;
}
@keyframes fadeInOut {
    0% { opacity: 0; transform: translateY(-10px); }
    10% { opacity: 1; transform: translateY(0); }
    80% { opacity: 1; }
    100% { opacity: 0; }
}

/* ── Utility ── */
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border-width: 0;
}
.text-destructive { color: var(--destructive); }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.max-w-500 { max-width: 500px; }
.max-w-600 { max-width: 600px; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.font-bold { font-weight: 700; }
