/**
 * Custom CSS for Pet Digital ID System
 */

/* Custom Variables */
:root {
    /* Primary Colors */
    --primary-blue: #2563eb;
    --secondary-green: #059669;
    --accent-purple: #7c3aed;
    
    /* Gradients */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --accent-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    
    /* Shadows */
    --card-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --button-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Typography */
body {
    font-family: 'Sarabun', 'Noto Sans Thai', sans-serif;
    color: #333;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
}

/* Admin Dashboard */
.admin-dashboard {
    padding: 1.5rem;
    background-color: var(--bg-secondary);
}

.stats-card {
    background-color: var(--bg-primary);
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.stats-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    transform: translateY(-2px);
}

/* Communities Page Styles */
.communities-page {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0e7ff 100%);
    min-height: 100vh;
}

.community-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.community-card:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
}

.community-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.community-stats {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    border-radius: 0.75rem;
    padding: 1rem;
    margin-top: 1rem;
}

.filter-section {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(20px);
    border-radius: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Enhanced Responsive Design - Mobile First Approach */
@media (max-width: 640px) {
    .community-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .community-card {
        margin-bottom: 1rem;
    }
    
    .filter-section .grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .stats-row {
        display: grid;
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    /* Mobile Typography */
    h1 { font-size: 1.75rem; line-height: 1.2; }
    h2 { font-size: 1.5rem; line-height: 1.3; }
    h3 { font-size: 1.25rem; line-height: 1.4; }
    h4 { font-size: 1.125rem; line-height: 1.4; }
    
    /* Mobile Spacing */
    .px-4 { padding-left: 0.75rem; padding-right: 0.75rem; }
    .py-8 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
    
    /* Mobile Cards */
    .cmcity-card {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }
    
    /* Mobile Buttons */
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}

/* Tablet */
@media (min-width: 641px) and (max-width: 1024px) {
    .community-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
    
    /* Tablet Typography */
    h1 { font-size: 2.25rem; }
    h2 { font-size: 1.875rem; }
    h3 { font-size: 1.5rem; }
    
    /* Tablet Spacing */
    .px-6 { padding-left: 1.25rem; padding-right: 1.25rem; }
    .py-12 { padding-top: 2.5rem; padding-bottom: 2.5rem; }
}

/* Desktop */
@media (min-width: 1025px) {
    .community-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
    
    /* Desktop Typography */
    h1 { font-size: 3rem; }
    h2 { font-size: 2.25rem; }
    h3 { font-size: 1.875rem; }
    
    /* Desktop Hover Effects */
    .hover-scale:hover {
        transform: scale(1.05);
        transition: transform 0.3s ease;
    }
}

/* Responsive Utilities */
.text-responsive-xs { font-size: 0.75rem; }
.text-responsive-sm { font-size: 0.875rem; }
.text-responsive-base { font-size: 1rem; }
.text-responsive-lg { font-size: 1.125rem; }
.text-responsive-xl { font-size: 1.25rem; }

@media (min-width: 640px) {
    .text-responsive-xs { font-size: 0.875rem; }
    .text-responsive-sm { font-size: 1rem; }
    .text-responsive-base { font-size: 1.125rem; }
    .text-responsive-lg { font-size: 1.25rem; }
    .text-responsive-xl { font-size: 1.5rem; }
}

@media (min-width: 1024px) {
    .text-responsive-xs { font-size: 1rem; }
    .text-responsive-sm { font-size: 1.125rem; }
    .text-responsive-base { font-size: 1.25rem; }
    .text-responsive-lg { font-size: 1.5rem; }
    .text-responsive-xl { font-size: 1.875rem; }
}

/* Responsive Grid Utilities */
.grid-responsive-1 { grid-template-columns: 1fr; }
.grid-responsive-2 { grid-template-columns: repeat(2, 1fr); }
.grid-responsive-3 { grid-template-columns: repeat(3, 1fr); }
.grid-responsive-4 { grid-template-columns: repeat(4, 1fr); }

@media (min-width: 640px) {
    .sm\:grid-responsive-2 { grid-template-columns: repeat(2, 1fr); }
    .sm\:grid-responsive-3 { grid-template-columns: repeat(3, 1fr); }
    .sm\:grid-responsive-4 { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1024px) {
    .lg\:grid-responsive-3 { grid-template-columns: repeat(3, 1fr); }
    .lg\:grid-responsive-4 { grid-template-columns: repeat(4, 1fr); }
    .lg\:grid-responsive-5 { grid-template-columns: repeat(5, 1fr); }
}

/* Touch-Friendly Elements */
@media (hover: none) and (pointer: coarse) {
    .btn, .card, .link {
        min-height: 44px;
        min-width: 44px;
    }
    
    .btn {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
}

/* Responsive Images */
.img-responsive {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Responsive Container */
.container-responsive {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .container-responsive {
        padding: 0 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container-responsive {
        padding: 0 2rem;
    }
}

/* Modal Responsive */
@media (max-width: 768px) {
    .modal-box {
        width: 95vw;
        max-width: none;
        margin: 1rem;
    }
    
    .modal-box .grid {
        grid-template-columns: 1fr;
    }
}

/* Table Responsive */
@media (max-width: 1024px) {
    .table-responsive {
        overflow-x: auto;
    }
    
    .table th,
    .table td {
        white-space: nowrap;
        min-width: 120px;
    }
}

/* Button hover effects */
.btn-hover-scale {
    transition: transform 0.2s ease;
}

.btn-hover-scale:hover {
    transform: scale(1.05);
}

/* Custom animations */
@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-up {
    animation: slideInUp 0.5s ease-out;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.fade-in-scale {
    animation: fadeInScale 0.3s ease-out;
}

/* Toast notifications */
.toast-notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    max-width: 400px;
    padding: 1rem;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    animation: slideInUp 0.3s ease-out;
}

.toast-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.toast-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.stats-number {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--primary-blue);
}

.stats-label {
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.admin-table {
    width: 100%;
    background-color: var(--bg-primary);
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: var(--card-shadow);
}

.admin-table th {
    background-color: var(--bg-secondary);
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.admin-table td {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-primary);
}

/* Card Enhancements */
.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-shadow);
}

/* Button Enhancements */
.btn {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--button-shadow);
}

.btn:active {
    transform: translateY(0);
}

/* Glass Morphism Effect */
.glass-card {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

/* Gradient Backgrounds */
.bg-gradient-primary {
    background: var(--primary-gradient);
}

.bg-gradient-secondary {
    background: var(--secondary-gradient);
}

.bg-gradient-accent {
    background: var(--accent-gradient);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

.animate-slide-up {
    animation: slideUp 0.5s ease-in-out;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Hero Section Enhancement */
.hero {
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--primary-gradient);
    opacity: 0.05;
    z-index: 0;
}

.hero-content {
    position: relative;
    z-index: 1;
}

/* Card Hover Effects */
.hover-card {
    transition: all 0.3s ease;
}

.hover-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Form Enhancements */
.input:focus, .textarea:focus, .select:focus {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* Table Enhancements */
.table tbody tr {
    transition: background-color 0.2s ease;
}

.table tbody tr:hover {
    background-color: rgba(37, 99, 235, 0.05);
}

/* Badge Enhancements */
.badge {
    font-weight: 500;
    letter-spacing: 0.025em;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .card-title {
        font-size: 1.25rem;
    }
    
    .hero-content {
        padding: 1.5rem;
    }
}

/* Accessibility Enhancements */
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Focus Indicators */
button:focus, a:focus, input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --primary-blue: #0000ff;
        --secondary-green: #008000;
        --accent-purple: #800080;
    }
    
    .card, .btn, .input, .textarea, .select {
        border: 1px solid #000;
    }
}

/* Custom Components */
.pet-card {
    border-radius: 0.5rem;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.pet-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--card-shadow);
}

.pet-card-image {
    height: 200px;
    object-fit: cover;
}

.pet-card-content {
    padding: 1.5rem;
}

/* QR Code Container */
.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background-color: white;
    border-radius: 0.5rem;
    box-shadow: var(--card-shadow);
}

.qr-image {
    width: 150px;
    height: 150px;
}

/* ID Card Styling */
.id-card {
    width: 100%;
    max-width: 400px;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    background-color: white;
}

.id-card-header {
    padding: 1rem;
    background: var(--primary-gradient);
    color: white;
    text-align: center;
}

.id-card-body {
    padding: 1.5rem;
}

.id-card-footer {
    padding: 0.75rem;
    background-color: #f3f4f6;
    text-align: center;
    font-size: 0.875rem;
}

/* Print Styles */
@media print {
    body {
        background-color: white;
    }
    
    .navbar, .footer, .btn, .print-hidden {
        display: none !important;
    }
    
    .container {
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .id-card {
        page-break-inside: avoid;
        margin: 0 auto;
    }
}