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

:root {
    --primary: #f97316;
    --primary-dark: #ea580c;
    --danger: #ef4444;
    --text: #1f2937;
    --text-light: #6b7280;
    --bg: #ffffff;
    --bg-gray: #f9fafb;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-gray);
    color: var(--text);
    line-height: 1.6;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: var(--bg);
    min-height: 100vh;
}

/* Tabs */
.tabs {
    display: flex;
    background: var(--bg);
    border-bottom: 2px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.tab-btn {
    flex: 1;
    padding: 1rem;
    border: none;
    background: none;
    color: var(--text-light);
    font-size: 1rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.tab-btn:hover {
    background: var(--bg-gray);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.tab-content {
    display: none;
    padding: 1.5rem;
}

.tab-content.active {
    display: block;
}

/* Emergency Header */
.emergency-header {
    background: var(--primary);
    color: white;
    text-align: center;
    padding: 1.5rem;
    margin: -1.5rem -1.5rem 1.5rem -1.5rem;
}

.emergency-header h1 {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: 0.05em;
}

/* Dog Photo */
.dog-photo-container {
    text-align: center;
    margin-bottom: 1.5rem;
}

.dog-photo {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--primary);
    box-shadow: var(--shadow);
}

.no-photo {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: var(--bg-gray);
    border: 4px dashed var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 1rem;
}

.dog-name {
    text-align: center;
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 2rem;
}

/* Info Sections */
.info-section {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.info-section h3 {
    font-size: 1.25rem;
    color: var(--text);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary);
}

.info-item {
    margin-bottom: 0.75rem;
    font-size: 1.125rem;
}

.info-item strong {
    color: var(--text-light);
    display: inline-block;
    min-width: 100px;
}

.info-item span {
    color: var(--text);
    font-weight: 500;
}

/* Alert Section (Allergies) */
.alert-section {
    border: 2px solid var(--danger);
    background: #fef2f2;
}

.alert-section h3 {
    color: var(--danger);
    border-bottom-color: var(--danger);
}

.allergies {
    color: var(--danger);
    font-size: 1.125rem;
    font-weight: 600;
    white-space: pre-wrap;
}

/* QR Section */
.qr-section {
    text-align: center;
    background: var(--bg-gray);
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.qr-section h3 {
    margin-bottom: 1rem;
    color: var(--text);
}

#qr-code {
    display: block;
    margin: 0 auto 1rem;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: white;
}

/* Buttons */
.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
    width: 100%;
    margin-bottom: 0.5rem;
}

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

.btn-secondary {
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-gray);
}

.actions {
    margin-top: 2rem;
}

/* Form Styles */
.form-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h3 {
    font-size: 1.25rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text);
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

#photo-preview-container {
    margin-top: 1rem;
    text-align: center;
}

#photo-preview {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    display: none;
    border: 2px solid var(--border);
}

#photo-preview.show {
    display: inline-block;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.form-actions .btn {
    margin-bottom: 0;
}

/* Settings */
.settings-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}

.settings-section:last-child {
    border-bottom: none;
}

.settings-section h2,
.settings-section h3 {
    font-size: 1.25rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

.settings-section p {
    margin-bottom: 0.75rem;
    color: var(--text-light);
}

.settings-section a {
    color: var(--primary);
    text-decoration: none;
}

.settings-section a:hover {
    text-decoration: underline;
}

/* Premium Features */
#premium-section {
    background: linear-gradient(135deg, #fff7ed 0%, #fed7aa 100%);
    border: 2px solid var(--primary);
    border-radius: 8px;
    padding: 1.5rem;
}

.premium-features {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
}

.premium-features li {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.95rem;
}

.premium-features li:last-child {
    border-bottom: none;
}

.settings-section .btn-primary {
    width: 100%;
    margin-top: 0.5rem;
}

.settings-section form {
    margin-top: 1rem;
}

.settings-section form label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text);
    font-weight: 500;
}

.settings-section form input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
}

.settings-section form input:focus {
    outline: none;
    border-color: var(--primary);
}

.hint {
    font-size: 0.9rem;
    color: var(--text-light);
}

/* Print Styles */
@media print {
    body {
        background: white;
    }

    .tabs,
    .actions,
    .qr-section button {
        display: none;
    }

    .container {
        max-width: 100%;
    }

    .tab-content {
        display: block !important;
    }

    #edit-tab,
    #settings-tab {
        display: none !important;
    }

    .info-section {
        page-break-inside: avoid;
        border: 2px solid #000;
        margin-bottom: 1rem;
    }

    .alert-section {
        border: 3px solid #000;
    }

    .emergency-header {
        background: #000;
        color: white;
        margin: 0 0 1rem 0;
        padding: 1rem;
    }

    .dog-photo {
        border-color: #000;
    }

    @page {
        margin: 1cm;
    }
}

/* Responsive */
@media (max-width: 640px) {
    .emergency-header h1 {
        font-size: 1.5rem;
    }

    .dog-name {
        font-size: 1.5rem;
    }

    .tab-btn {
        font-size: 0.875rem;
        padding: 0.75rem 0.5rem;
    }

    .form-actions {
        flex-direction: column;
    }
}
