:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --secondary: #ec4899;
    --bg-dark: #0f172a;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.1);
    --grad: linear-gradient(135deg, var(--primary), var(--secondary));
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg-dark);
    color: var(--text-main);
    font-family: 'Plus Jakarta Sans', sans-serif;
    overflow-x: hidden;
    line-height: 1.6;
}

h1, h2, h3 {
    font-family: 'Outfit', sans-serif;
}

/* Glassmorphism Navigation */
.glass-nav {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 1200px;
    padding: 15px 30px;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 1000;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.logo span {
    color: var(--primary);
}

.brand-logo {
    height: 40px;
    margin-right: 12px;
    vertical-align: middle;
}

.nav-links {
    display: flex;
    align-items: center;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    margin-right: 25px;
    font-size: 0.9rem;
    transition: color 0.3s;
}

.nav-links span {
    display: flex;
    align-items: center;
    gap: 15px;
}

#user-email {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.nav-links a:hover {
    color: var(--text-main);
}

.btn-primary {
    background: var(--grad);
    border: none;
    padding: 10px 20px;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    cursor: pointer !important;
    transition: transform 0.3s, box-shadow 0.3s;
    position: relative;
    z-index: 10;
    pointer-events: auto !important;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

/* Hero Section */
.hero {
    min-height: 100vh;
    padding: 160px 5% 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
}

.hero-content {
    flex: 1;
    max-width: 600px;
}

.hero h1 {
    font-size: 4.5rem;
    line-height: 1.1;
    margin-bottom: 20px;
    font-weight: 800;
}

.hero h1 span {
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    color: var(--text-muted);
    font-size: 1.2rem;
    margin-bottom: 40px;
}

.btn-main {
    padding: 16px 32px;
    border-radius: 16px;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer !important;
    border: none;
    background: var(--primary);
    color: white;
    margin-right: 20px;
    transition: all 0.3s;
    position: relative;
    z-index: 10;
    pointer-events: auto !important;
}

.btn-main.secondary {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
}

.hero-visual {
    flex: 1;
    display: flex;
    justify-content: center;
    position: relative;
}

.blob {
    position: absolute;
    width: 500px;
    height: 500px;
    background: var(--grad);
    filter: blur(80px);
    opacity: 0.2;
    border-radius: 50%;
    animation: pulse 10s infinite alternate;
}

@keyframes pulse {
    from { transform: scale(1); }
    to { transform: scale(1.2); }
}

#hero-img {
    width: 100%;
    max-width: 500px;
    position: relative;
    z-index: 1;
    filter: drop-shadow(0 20px 50px rgba(0,0,0,0.5));
}

/* Section Headers */
.section-header {
    text-align: center;
    margin-bottom: 60px;
}

.section-header h2 {
    font-size: 3rem;
    margin-bottom: 10px;
}

.section-header p {
    color: var(--text-muted);
}

/* App Download Section */
.app-download-section {
    margin: 80px 5%;
    padding: 80px 60px;
    border-radius: 48px;
    display: flex;
    justify-content: center;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(236, 72, 153, 0.05) 100%);
    border: 1px solid var(--glass-border);
}

.app-content {
    max-width: 1200px;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 80px;
    align-items: center;
}

.app-text h2 {
    font-size: 3.5rem;
    margin-bottom: 25px;
    line-height: 1.2;
}

.app-text p {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 40px;
}

.download-btns {
    display: flex;
    gap: 20px;
}

.download-btns .btn-main {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    padding: 18px 36px;
}

.app-preview {
    display: flex;
    justify-content: center;
    perspective: 1000px;
}

.phone-frame {
    width: 320px;
    height: 640px;
    border-radius: 40px;
    padding: 12px;
    border: 8px solid #1e293b;
    box-shadow: 0 50px 100px -20px rgba(0,0,0,0.5);
    background: var(--bg-dark);
    position: relative;
    transform: rotateY(-15deg) rotateX(5deg);
    transition: transform 0.5s ease;
}

.phone-frame:hover {
    transform: rotateY(0deg) rotateX(0deg);
}

.notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 25px;
    background: #1e293b;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    z-index: 10;
}

.screen {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at top, #1e293b, #0f172a);
    border-radius: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.app-logo-preview {
    width: 120px;
    animation: floating 3s ease-in-out infinite;
}

@keyframes floating {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@media (max-width: 968px) {
    .app-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .download-btns {
        justify-content: center;
    }
    .phone-frame {
        display: none;
    }
}

/* Features Container */
.features-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

/* About Section */
.about-section {
    padding: 100px 5%;
}

.about-section .container {
    padding: 60px;
    text-align: center;
}

.about-section h2 {
    margin-bottom: 30px;
    font-size: 2.5rem;
}

.about-content {
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.2rem;
    color: var(--text-muted);
}

/* Grid Section Restructure */
.grid-section {
    padding: 100px 5%;
    max-width: 1400px;
    margin: 0 auto;
}

.feature-card {
    padding: 40px;
    border-radius: 32px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    transition: all 0.5s cubic-bezier(0.23, 1, 0.32, 1);
    cursor: default;
    position: relative;
    overflow: hidden;
}

.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.1), transparent);
    opacity: 0;
    transition: opacity 0.5s ease;
}

.feature-card:hover::before {
    opacity: 1;
}

.feature-card:hover {
    transform: translateY(-10px);
    background: rgba(255,255,255,0.05);
}

.feature-card .icon {
    width: 60px;
    height: 60px;
    background: rgba(var(--primary-rgb), 0.1);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    color: var(--primary);
    transition: all 0.3s ease;
}

.feature-card:hover .icon {
    background: var(--grad);
    color: white;
    transform: translateY(-5px) rotate(5deg);
}

.pet-card {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s ease;
    cursor: default;
    padding: 30px;
}

.pet-card:hover {
    transform: translateY(-5px) scale(1.02);
    border-color: var(--primary);
}

.pet-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--glass-border);
}

.pet-identity h3 {
    font-size: 1.8rem;
    margin-bottom: 5px;
    background: var(--grad);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.species-badge {
    font-size: 0.7rem;
    font-weight: 800;
    padding: 4px 12px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.pet-details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.detail-item label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 5px;
    font-weight: 600;
}

.detail-item p {
    font-size: 1rem;
    color: var(--text-main);
    font-weight: 500;
}

.detail-item.full {
    grid-column: span 2;
}

/* View Management */
.view-section {
    display: none;
    padding: 120px 5% 80px;
}

/* Pet Passport Premium Styles */
#passport-modal .modal-content {
    max-width: 900px;
    padding: 0;
    overflow: hidden;
    border: none;
}

.passport-container {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    min-height: 500px;
}

.passport-card-visual {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px solid var(--glass-border);
}

.passport-header-visual {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.passport-logo {
    font-size: 1.5rem;
    font-weight: 800;
}

.passport-logo span {
    color: var(--primary);
}

.passport-type {
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 3px;
    color: var(--text-muted);
    opacity: 0.5;
}

.passport-body-visual {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.passport-photo-placeholder {
    width: 150px;
    height: 180px;
    background: rgba(255,255,255,0.03);
    border: 2px solid var(--glass-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
}

.passport-main-info {
    flex: 1;
}

.info-row {
    display: flex;
    gap: 20px;
    margin-bottom: 25px;
}

.info-col {
    flex: 1;
}

.info-col label {
    display: block;
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 5px;
}

.info-val {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
}

.info-val.subtitle {
    font-size: 0.8rem;
    color: var(--primary-light);
    font-family: monospace;
}

.passport-side-records {
    padding: 40px;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.records-section h4 {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.passport-qr-section {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid var(--glass-border);
}

#qr-canvas {
    background: white;
    padding: 10px !important;
    border-radius: 12px;
    margin-bottom: 15px;
    width: 160px;
    height: 160px;
}

.qr-label {
    display: block;
    font-size: 0.6rem;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--text-muted);
}

.view-section.active {
    display: block;
    animation: fadeIn 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

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

.hidden {
    display: none !important;
}

.view-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
}

.btn-back {
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--glass-border);
    color: white;
    padding: 8px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-back:hover {
    background: rgba(255,255,255,0.1);
}

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

/* Dashboard Styles */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-top: 40px;
}

.glass-list {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 20px;
}

/* Upload Area */
.upload-area {
    border: 2px dashed var(--glass-border);
    border-radius: 24px;
    padding: 60px;
    text-align: center;
    cursor: pointer;
    transition: background 0.3s;
}

.upload-icon {
    font-size: 4rem;
    margin-bottom: 20px;
    opacity: 0.5;
}

.upload-area .small {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 10px;
}

/* Loading Spinner */
#loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 30px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.result-card {
    margin-top: 30px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 32px;
    display: block; /* Stacked layout for better flow */
}

.result-header {
    display: flex;
    align-items: center;
    gap: 25px;
    margin-bottom: 25px;
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 20px;
}

.score-ring {
    width: 90px;
    height: 90px;
    background: var(--grad);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    font-weight: 800;
}

.score-ring small {
    font-size: 0.8rem;
    opacity: 0.8;
    font-weight: 400;
}

.status-badge {
    padding: 6px 16px;
    border-radius: 30px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    display: inline-block;
    margin-top: 8px;
}

.status-comfortable { background: #10B981; color: white; }
.status-mild { background: #F59E0B; color: white; }
.status-moderate { background: #EF4444; color: white; }
.status-severe { background: #7F1D1D; color: white; }

.findings-grid {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 20px;
    margin-top: 20px;
}

.findings-label {
    font-weight: 600;
    color: var(--primary);
}

.recommendation-box {
    margin-top: 30px;
    padding: 20px;
    background: rgba(var(--primary-rgb), 0.1);
    border-left: 4px solid var(--primary);
    border-radius: 0 16px 16px 0;
}

.recommendation-box h4 {
    margin-bottom: 10px;
    font-size: 1.1rem;
    color: var(--primary);
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal-content {
    width: 95%;
    max-width: 550px;
    padding: 50px;
    border-radius: 40px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
    margin-bottom: 8px;
    font-size: 2.2rem;
    font-weight: 800;
}

.modal-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 25px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-left: 5px;
}

#add-pet-form input, 
#add-pet-form select,
#add-pet-form textarea,
#signin-form input,
#signup-form input {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    padding: 18px 20px;
    border-radius: 16px;
    color: white;
    font-family: inherit;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#add-pet-form select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='rgba(255,255,255,0.5)' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 20px center;
    background-size: 18px;
    padding-right: 50px;
    cursor: pointer;
}

#add-pet-form select option {
    background: #0f172a;
    color: white;
}

#add-pet-form input:focus, 
#add-pet-form select:focus,
#add-pet-form textarea:focus,
#signin-form input:focus,
#signup-form input:focus {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.15);
    outline: none;
}

/* Passport Styles */
.passport-container {
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 30px;
}

.passport-qr {
    background: white;
    padding: 15px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #000;
}

.passport-qr canvas {
    max-width: 100%;
}

.passport-qr span {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.vaccination-list {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vaccination-item {
    padding: 12px 15px;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.vaccination-item .type {
    font-weight: 600;
}

.vaccination-item .date {
    font-size: 0.85rem;
    color: var(--text-muted);
}
