/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4CAF50;
    --primary-dark: #45a049;
    --secondary: #FF6B6B;
    --accent: #4ECDC4;
    --text: #333;
    --text-light: #666;
    --background: #f8f9fa;
    --white: #ffffff;
    --border: #e0e0e0;
    --shadow: 0 2px 10px rgba(0,0,0,0.1);
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --info: #17a2b8;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--background);
    min-height: 100vh;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1rem;
    color: var(--text);
    font-weight: 600;
    line-height: 1.3;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 1rem; }

p {
    margin-bottom: 1rem;
}

/* Layout */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header & Navigation */
.header {
    background: var(--white);
    box-shadow: var(--shadow);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary);
    text-decoration: none;
    display: flex;
    align-items: center;
}

.logo span {
    color: var(--secondary);
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 1.5rem;
    align-items: center;
}

.nav-link {
    text-decoration: none;
    color: var(--text);
    font-weight: 500;
    transition: color 0.3s;
    padding: 0.5rem 0;
    display: block;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
}

.hamburger {
    display: none;
    cursor: pointer;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text);
    padding: 0.5rem;
}

/* Hero Section */
.hero {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: var(--white);
    padding: 8rem 1rem 4rem;
    text-align: center;
    margin-top: 70px;
}

.hero h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: var(--white);
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
    font-size: 1rem;
    min-height: 44px;
    font-family: inherit;
    line-height: 1;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.btn-secondary {
    background: var(--secondary);
    color: var(--white);
}

.btn-secondary:hover {
    background: #e55c5c;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
    transform: translateY(-2px);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-warning {
    background: var(--warning);
    color: var(--text);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}

.btn-info {
    background: var(--info);
    color: var(--white);
}

/* Cards */
.card {
    background: var(--white);
    border-radius: 10px;
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid var(--border);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.card-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(45deg, #f8f9fa, #e9ecef);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 0.9rem;
}

.card-img::before {
    content: "🐾 Pet Image";
}

.card-img[src*="default-pet.jpg"]::before,
.card-img:not([src])::before {
    content: "🐾 No Image";
}

.card-body {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.card-text {
    color: var(--text-light);
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* Grid System */
.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: 1fr; }
.grid-3 { grid-template-columns: 1fr; }
.grid-4 { grid-template-columns: 1fr; }

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 5px;
    font-size: 1rem;
    transition: border-color 0.3s;
    font-family: inherit;
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.form-select {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border);
    border-radius: 5px;
    font-size: 1rem;
    background: var(--white);
    font-family: inherit;
    cursor: pointer;
}

.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 5px;
    margin-bottom: 1rem;
    border-left: 4px solid transparent;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-color: var(--success);
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-color: var(--danger);
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-color: var(--warning);
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-color: var(--info);
}

/* Dashboard */
.dashboard {
    padding: 6rem 1rem 2rem;
    min-height: calc(100vh - 70px);
}

.stats-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: var(--shadow);
    text-align: center;
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-3px);
}

.stat-number {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
    display: block;
    line-height: 1;
}

/* Pet Grid */
.pet-grid {
    display: grid;
    gap: 1.5rem;
    margin: 2rem 0;
}

.pet-card {
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform 0.3s, box-shadow 0.3s;
    border: 1px solid var(--border);
}

.pet-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.pet-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(45deg, #f8f9fa, #e9ecef);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-light);
    font-size: 0.9rem;
}

.pet-image::before {
    content: "🐾 Pet Image";
}

.pet-image[src*="default-pet.jpg"]::before,
.pet-image:not([src])::before {
    content: "🐾 No Image";
}

.pet-info {
    padding: 1rem;
}

.pet-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background: var(--primary);
    color: var(--white);
    border-radius: 15px;
    font-size: 0.8rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.pet-badge.secondary {
    background: var(--secondary);
}

.pet-badge.accent {
    background: var(--accent);
}

.pet-badge.warning {
    background: var(--warning);
    color: var(--text);
}

.pet-badge.danger {
    background: var(--danger);
}

.pet-badge.info {
    background: var(--info);
}

/* Chat System */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 70vh;
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
    background: var(--white);
}

.chat-header {
    background: var(--primary);
    color: var(--white);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 300px;
}

.message {
    padding: 0.75rem 1rem;
    border-radius: 15px;
    max-width: 70%;
    word-wrap: break-word;
    position: relative;
    line-height: 1.4;
}

.message.sent {
    background: var(--primary);
    color: var(--white);
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.message.received {
    background: var(--white);
    border: 1px solid var(--border);
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}

.message.initial {
    background: #e7f3ff;
    border: 1px solid #b3d9ff;
    align-self: center;
    max-width: 90%;
    text-align: center;
}

.message-time {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.5rem;
    display: block;
}

.message-sender {
    font-size: 0.8rem;
    font-weight: bold;
    margin-bottom: 0.25rem;
    display: block;
}

.chat-input {
    padding: 1rem;
    background: var(--white);
    border-top: 1px solid var(--border);
}

.chat-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pet-info-sidebar {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    height: fit-content;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: var(--text);
}

tr:hover {
    background: #f8f9fa;
}

/* Footer */
.footer {
    background: var(--text);
    color: var(--white);
    padding: 3rem 1rem;
    margin-top: 4rem;
}

.footer-grid {
    display: grid;
    gap: 2rem;
}

.footer-links a {
    display: block;
    color: var(--white);
    text-decoration: none;
    margin-bottom: 0.5rem;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.footer-links a:hover {
    opacity: 1;
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mt-3 { margin-top: 3rem; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.mb-3 { margin-bottom: 3rem; }

.p-1 { padding: 1rem; }
.p-2 { padding: 2rem; }
.p-3 { padding: 3rem; }

.d-flex { display: flex; }
.d-grid { display: grid; }
.d-none { display: none; }
.d-block { display: block; }
.d-inline { display: inline; }
.d-inline-block { display: inline-block; }

.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.align-center { align-items: center; }
.align-start { align-items: flex-start; }

.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }

.gap-1 { gap: 1rem; }
.gap-2 { gap: 2rem; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

.rounded { border-radius: 5px; }
.rounded-lg { border-radius: 10px; }

.shadow { box-shadow: var(--shadow); }
.shadow-lg { box-shadow: 0 8px 25px rgba(0,0,0,0.15); }

/* Image Handling */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

.pet-image,
.card-img {
    background: linear-gradient(45deg, #f8f9fa, #e9ecef);
    position: relative;
}

.pet-image::before,
.card-img::before {
    content: "🐾 Pet Image";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-light);
    font-size: 0.9rem;
}

.pet-image[src*="default-pet.jpg"]::before,
.pet-image:not([src])::before,
.card-img[src*="default-pet.jpg"]::before,
.card-img:not([src])::before {
    content: "🐾 No Image";
}

/* Ensure images with actual src don't show placeholder text */
.pet-image[src]:not([src*="default-pet.jpg"])::before,
.card-img[src]:not([src*="default-pet.jpg"])::before {
    display: none;
}

/* Mobile First Media Queries */

/* Small devices (landscape phones, 480px and up) */
@media (min-width: 480px) {
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    
    .hero h1 { font-size: 2.75rem; }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .hamburger { display: none; }
    .nav-menu { display: flex; }
    
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(4, 1fr); }
    .stats-grid { grid-template-columns: repeat(4, 1fr); }
    
    .hero { padding: 10rem 2rem 6rem; }
    .hero h1 { font-size: 3rem; }
    
    .dashboard { padding: 8rem 2rem 4rem; }
    
    .footer-grid { grid-template-columns: repeat(4, 1fr); }
    
    .container { padding: 0 2rem; }
    .navbar { padding: 1rem 2rem; }
}

/* Large devices (desktops, 1024px and up) */
@media (min-width: 1024px) {
    .hero h1 { font-size: 3.5rem; }
    
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(4, 1fr); }
    
    .chat-container {
        height: 600px;
    }
}

/* Extra large devices (1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
    }
}

/* Mobile Navigation */
@media (max-width: 767px) {
    .hamburger { 
        display: block;
        z-index: 1001;
    }
    
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background: var(--white);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: var(--shadow);
        padding: 2rem 0;
        z-index: 999;
    }
    
    .nav-menu.active {
        left: 0;
    }
    
    .nav-item {
        margin: 1rem 0;
        width: 100%;
    }
    
    .nav-link {
        padding: 1rem;
        border-bottom: 1px solid var(--border);
    }
    
    /* Mobile chat improvements */
    .message {
        max-width: 85%;
    }
    
    .chat-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .chat-actions .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    /* Mobile grid adjustments */
    .grid-1.grid-3,
    .grid-1.grid-2 {
        grid-template-columns: 1fr;
    }
    
    .pet-grid.grid-3 {
        grid-template-columns: 1fr;
    }
}

/* Print Styles */
@media print {
    .no-print { display: none !important; }
    .header { position: static; }
    .btn { display: none; }
    body { background: white !important; }
    .container { max-width: 100% !important; padding: 0 !important; }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for accessibility */
button:focus,
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary: #004400;
        --secondary: #880000;
        --text: #000000;
        --border: #000000;
    }
    
    .card {
        border: 2px solid var(--border);
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --background: #1a1a1a;
        --text: #ffffff;
        --text-light: #cccccc;
        --white: #2d2d2d;
        --border: #444444;
    }
    
    .card {
        background: var(--white);
    }
    
    .form-control,
    .form-select {
        background: #3d3d3d;
        color: var(--text);
        border-color: #555555;
    }
}