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

:root {
    --primary-blue: #1f29f0;
    --primary-cyan: #06b6d4;
    --bg-white: #ffffff;
    --bg-light: #f1f5f9;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-dark);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    overflow-x: hidden;
}

.iphone-container {
    width: 100%;
    max-width: 430px;
    min-height: 100vh;
    background: linear-gradient(135deg, #f0fdf4 0%, #ffffff 40%, #eff6ff 100%);
    position: relative;
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-x: hidden;
    overflow-y: auto;
}

img {
    max-width: 100%;
    height: auto;
}

/* Background Blobs */
.blob {
    position: absolute;
    width: 300px;
    height: 300px;
    filter: blur(80px);
    z-index: 0;
    opacity: 0.4;
}

.blob-1 {
    background: #60a5fa;
    top: -100px;
    left: -100px;
}

.blob-2 {
    background: #1f29f0;
    bottom: -100px;
    right: -100px;
}

/* Header */
header {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
}

.logo-wrapper {
    width: 80px;
    height: 80px;
    background: white;
    padding: 2px;
    border-radius: 22px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

.logo-wrapper img {
    width: 100%;
    height: 100%;
    border-radius: 20px;
    object-fit: cover;
}

.title-container h1 {
    font-size: 1.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: -0.025em;
    color: #1e293b;
}

.title-container h1 span {
    color: var(--primary-red);
}

.subtitle-badge {
    display: inline-block;
    background: rgba(31, 41, 240, 0.05);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(31, 41, 240, 0.1);
    padding: 0.5rem 1.25rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--primary-blue);
    letter-spacing: 0.05em;
    margin-top: 0.5rem;
    box-shadow: var(--glass-shadow);
}

/* Hero Card */
.hero-card {
    position: relative;
    z-index: 10;
    background: linear-gradient(135deg, #1f29f0 0%, #10b981 100%);
    border-radius: 2.5rem;
    padding: 2rem;
    color: white;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(31, 41, 240, 0.2);
}

.hero-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 150px;
    height: 150px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2) 0%, transparent 70%);
    z-index: 1;
}

.hero-icon-box {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.hero-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.hero-card p {
    font-size: 0.9rem;
    opacity: 0.9;
    margin-bottom: 2rem;
    line-height: 1.4;
}

.hero-cta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
}

/* Action Cards */
.action-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    z-index: 10;
}

.action-card {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 1.5rem;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
    cursor: pointer;
}

.action-card:active {
    transform: scale(0.98);
}

.icon-circle {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-red {
    background: rgba(31, 41, 240, 0.1);
    color: var(--primary-blue);
}

.icon-blue {
    background: rgba(6, 182, 212, 0.1);
    color: var(--primary-cyan);
}

.action-content {
    flex: 1;
}

.action-content h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.action-content p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.chevron {
    color: #94a3b8;
}

/* Star Decoration in Hero */
.star-decoration {
    position: absolute;
    bottom: 10%;
    right: 5%;
    opacity: 0.2;
    z-index: 1;
}

/* Responsive adjustments */
@media (max-width: 430px) {
    .iphone-container {
        padding: 4rem 1.25rem;
    }
}

/* --- Phase 2: Virtual DPI Card Styles --- */
.virtual-dpi-wrapper {
    perspective: 1000px;
    margin-bottom: 2rem;
    z-index: 10;
}

.virtual-dpi-card {
    width: 100%;
    aspect-ratio: 1.6 / 1;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border-radius: 1rem;
    padding: 1.25rem;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.virtual-dpi-card:hover {
    transform: rotateX(5deg) rotateY(-2deg);
}

.dpi-header {
    font-size: 0.55rem;
    color: #0c4a6e;
    font-weight: 700;
    text-align: left;
    border-bottom: 1px solid rgba(12, 74, 110, 0.1);
    padding-bottom: 0.4rem;
    line-height: 1.2;
    z-index: 2;
}

.dpi-header span {
    font-size: 0.45rem;
    display: block;
    font-weight: 500;
    margin-top: 2px;
}

.dpi-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex: 1;
    z-index: 2;
}

.dpi-chip {
    width: 45px;
    height: 35px;
}

.dpi-info {
    flex: 1;
    padding-left: 1rem;
}

.dpi-field {
    margin-bottom: 0.4rem;
}

.dpi-field label {
    font-size: 0.45rem;
    color: #0369a1;
    font-weight: 700;
    display: block;
    margin-bottom: 1px;
    letter-spacing: 0.02em;
}

.dpi-field .value {
    font-size: 0.8rem;
    font-weight: 800;
    color: #0f172a;
    font-family: 'Courier New', Courier, monospace;
}

.dpi-coat-of-arms {
    width: 65px;
    display: flex;
    justify-content: flex-end;
}

.tikal-bg {
    position: absolute;
    bottom: -10px;
    left: 20%;
    width: 80%;
    height: 70%;
    z-index: 1;
    opacity: 0.15;
    pointer-events: none;
}

/* --- Phase 2: Registration & Validation Styles --- */

/* App Header with Back Button */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 2rem;
    z-index: 10;
}

.back-btn {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: white;
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-dark);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    cursor: pointer;
    text-decoration: none;
}

.header-center {
    text-align: center;
}

.header-center h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-blue);
    line-height: 1;
}

.header-center p {
    font-size: 0.65rem;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    font-weight: 600;
}

.user-icon {
    width: 44px;
    height: 44px;
    background: #eff6ff;
    color: var(--primary-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Grid for smaller upload cards */
.upload-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.small-upload-card {
    background: white;
    border-radius: 1.5rem;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    border: 1px solid #f1f5f9;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

.small-upload-card i {
    color: #cbd5e1;
}

.small-upload-card p {
    font-size: 0.7rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
}

/* Form Styling */
.form-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.75rem;
    font-weight: 700;
    color: #475569;
    letter-spacing: 0.05em;
}

.input-wrapper {
    position: relative;
    background: white;
    border-radius: 1rem;
    border: 1px solid #f1f5f9;
    padding: 1rem 1rem 1rem 3.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

.input-wrapper i {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: #1e293b;
    opacity: 0.6;
}

.input-wrapper input {
    border: none;
    background: none;
    width: 100%;
    font-family: inherit;
    font-size: 1rem;
    color: #1e293b;
    outline: none;
}

.input-wrapper input::placeholder {
    color: #cbd5e1;
}

/* Primary Button */
.btn-primary {
    background: linear-gradient(135deg, #1f29f0 0%, #171ed1 100%);
    color: white;
    border: none;
    border-radius: 1.25rem;
    padding: 1.25rem;
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    cursor: pointer;
    margin-top: 1rem;
    box-shadow: 0 10px 25px rgba(31, 41, 240, 0.2);
}

/* Result Page Styles */
.result-header {
    text-align: center;
    margin-bottom: 2rem;
}

.profile-container {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 1.5rem;
}

.profile-img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid white;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.status-badge {
    background: #f0fdf4;
    color: #16a34a;
    padding: 0.25rem 1rem;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    display: inline-block;
}

.citizen-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0.75rem 0 0.25rem;
    text-transform: uppercase;
    line-height: 1.2;
}

.citizen-cui {
    font-size: 0.9rem;
    color: #94a3b8;
    letter-spacing: 0.05em;
}

/* Data Table */
.data-card {
    background: white;
    border-radius: 1.5rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
}

.data-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #f1f5f9;
}

.data-card-header h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: #1e293b;
}

.data-row {
    margin-bottom: 1rem;
}

.data-row .label {
    font-size: 0.65rem;
    font-weight: 700;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
}

.data-row .value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #1e293b;
}

/* Footer Actions */
.footer-actions {
    display: grid;
    grid-template-columns: 0.4fr 1fr;
    gap: 0.75rem;
    margin-top: auto;
    padding-top: 2rem;
}

.btn-secondary {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 1.25rem;
    padding: 1.25rem;
    font-weight: 700;
    color: #64748b;
    cursor: pointer;
}

/* Camera Overlay */
.camera-container {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    background: #000;
    border-radius: 2rem;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.camera-overlay {
    position: absolute;
    inset: 0;
    border: 2px solid rgba(255, 255, 255, 0.5);
    margin: 2rem;
    border-radius: 1rem;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.4);
}

.scanning-line {
    position: absolute;
    top: 2rem;
    left: 2rem;
    right: 2rem;
    height: 2px;
    background: var(--primary-blue);
    box-shadow: 0 0 15px var(--primary-blue);
    animation: scan 2s infinite linear;
}

img {
    max-width: 100%;
    height: auto;
}

@keyframes scan {
    0% {
        top: 2rem;
    }

    50% {
        top: calc(100% - 2rem);
    }

    100% {
        top: 2rem;
    }
}

/* --- Phase 2: Camera Modal & Capture Styles --- */
.camera-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 1000;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.camera-modal.active {
    display: flex;
}

.camera-preview-container {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 3/4;
    background: #111;
    border-radius: 2rem;
    overflow: hidden;
    position: relative;
    border: 3px solid rgba(255, 255, 255, 0.1);
}

.camera-preview-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.capture-controls {
    display: flex;
    gap: 1.5rem;
    margin-top: 2rem;
    align-items: center;
}

.btn-capture {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: white;
    border: 5px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.2);
    transition: transform 0.2s;
}

.btn-capture:active {
    transform: scale(0.9);
}

.btn-close-camera {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* Thumbnail Previews */
.card-preview {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background-size: cover;
    background-position: center;
    border-radius: inherit;
    display: none;
    z-index: 5;
}

.card-preview.active {
    display: block;
}

.captured-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #16a34a;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
    font-size: 14px;
}

.captured .captured-icon {
    display: flex;
}