/* responsive.css - Unified Responsive Design System for VetCare */
/* Add this to all pages or include via a separate file */

:root {
    --sidebar-width: 260px;
    --sidebar-collapsed: 80px;
    --breakpoint-sm: 576px;
    --breakpoint-md: 768px;
    --breakpoint-lg: 992px;
    --breakpoint-xl: 1200px;
    --breakpoint-xxl: 1400px;
}

/* ========== BASE RESPONSIVE UTILITIES ========== */

/* Hide on specific breakpoints */
.hide-on-mobile {
    display: inline-block;
}

.hide-on-desktop {
    display: none;
}

/* Responsive text utilities */
.text-responsive {
    font-size: clamp(0.875rem, 4vw, 1rem);
}

.heading-responsive {
    font-size: clamp(1.25rem, 6vw, 1.8rem);
}

/* ========== SIDEBAR RESPONSIVE BEHAVIOR ========== */

/* Desktop default - sidebar visible */
@media (min-width: 769px) {
    .sidebar {
        transform: translateX(0) !important;
    }
    
    .sidebar.collapsed ~ .content,
    .sidebar.collapsed + .content {
        margin-left: 80px !important;
    }
    
    .sidebar:not(.collapsed) ~ .content,
    .sidebar:not(.collapsed) + .content {
        margin-left: 260px !important;
    }
}

/* Tablet and Mobile - Collapsible sidebar with hamburger */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
        transition: transform 0.3s ease;
        z-index: 1050;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar.mobile-open {
        transform: translateX(0) !important;
    }
    
    .sidebar.collapsed {
        transform: translateX(-100%);
        width: 260px;
    }
    
    .content {
        margin-left: 0 !important;
        padding: 16px;
        width: 100%;
    }
    
    /* Hamburger menu button */
    .mobile-menu-toggle {
        display: flex;
        position: fixed;
        top: 16px;
        left: 16px;
        z-index: 1060;
        background: var(--teal-primary);
        border: none;
        color: white;
        width: 44px;
        height: 44px;
        border-radius: 12px;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    }
    
    .mobile-menu-toggle i {
        font-size: 1.25rem;
    }
    
    /* Overlay when sidebar is open */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1040;
    }
    
    .sidebar-overlay.active {
        display: block;
    }
    
    /* Adjust top header for mobile */
    .top-header {
        margin-top: 56px;
    }
}

/* Desktop toggle button visibility */
#sidebarToggleBtn {
    display: flex;
}

@media (max-width: 768px) {
    #sidebarToggleBtn {
        display: none;
    }
}

/* ========== TOP HEADER RESPONSIVE ========== */

@media (max-width: 768px) {
    .top-header {
        grid-template-columns: 1fr;
        gap: 1rem;
        border-radius: 20px;
        padding: 16px;
        margin-top: 52px;
    }
    
    .breadcrumb {
        order: 1;
    }
    
    .search-container {
        order: 2;
        max-width: 100%;
        margin: 0;
    }
    
    .top-actions {
        order: 3;
        justify-content: flex-end;
    }
    
    .user-profile-header {
        padding: 4px 8px;
    }
    
    .user-info-header strong {
        font-size: 0.8rem;
    }
    
    .user-info-header span {
        font-size: 0.65rem;
    }
    
    .search-shortcut {
        display: none;
    }
}

@media (max-width: 480px) {
    .top-header {
        padding: 12px;
        margin-top: 52px;
    }
    
    .user-info-header {
        display: none;
    }
    
    .user-profile-header {
        padding: 6px;
    }
    
    .user-profile-header img {
        width: 36px;
        height: 36px;
    }
}

/* ========== DASHBOARD/RESPONSIVE GRIDS ========== */

/* Stats Grid */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* Dashboard Layout (2-column) */
@media (max-width: 1024px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Stats Cards (analytics page) */
@media (max-width: 1024px) {
    .analytics-stats {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .analytics-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .analytics-stats {
        grid-template-columns: 1fr;
    }
}

/* ========== APPOINTMENTS PAGE RESPONSIVE ========== */

/* Calendar View */
@media (max-width: 1200px) {
    .calendar-grid {
        grid-template-columns: 70px repeat(7, minmax(100px, 1fr));
        min-width: auto;
        overflow-x: auto;
    }
    
    .grid-cell {
        min-width: 100px;
    }
}

@media (max-width: 768px) {
    .calendar-grid {
        grid-template-columns: 60px repeat(7, minmax(85px, 1fr));
    }
    
    .grid-header {
        padding: 10px 6px;
    }
    
    .day-name {
        font-size: 0.7rem;
    }
    
    .day-date {
        font-size: 0.85rem;
    }
    
    .time-slot-label {
        font-size: 0.7rem;
        padding: 8px 6px 0 6px;
    }
    
    .grid-cell {
        min-width: 85px;
        padding: 4px;
    }
    
    .appt-card {
        padding: 4px 6px;
        font-size: 0.6rem;
    }
    
    .appt-pet {
        font-size: 0.65rem;
    }
    
    .appt-type-badge,
    .appt-owner {
        display: none;
    }
}

@media (max-width: 480px) {
    .calendar-grid {
        grid-template-columns: 55px repeat(7, minmax(70px, 1fr));
    }
    
    .grid-cell {
        min-width: 70px;
        height: 70px;
    }
    
    .appt-card .appt-time-badge {
        font-size: 0.55rem;
    }
}

/* Appointment List Cards */
@media (max-width: 768px) {
    .appointment-card-large {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 16px;
    }
    
    .card-left-section {
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }
    
    .time-display {
        min-width: auto;
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }
    
    .card-right-section {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    
    .status-select-wrapper {
        min-width: auto;
    }
    
    .status-select {
        font-size: 0.7rem;
        padding: 4px 8px;
    }
}

/* Scheduler Controls */
@media (max-width: 768px) {
    .scheduler-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .scheduler-controls {
        flex-direction: column;
        width: 100%;
    }
    
    .view-picker {
        width: 100%;
        justify-content: center;
    }
    
    .nav-arrows {
        width: 100%;
        justify-content: center;
    }
    
    .scheduler-controls .new-appt-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Month View */
@media (max-width: 768px) {
    .month-cell {
        min-height: 80px;
    }
    
    .month-day-number {
        font-size: 0.75rem;
    }
    
    .month-appointment {
        font-size: 0.6rem;
        white-space: normal;
        line-height: 1.2;
    }
    
    .month-appointment .appt-time {
        display: block;
        font-size: 0.55rem;
    }
    
    .month-stats {
        flex-wrap: wrap;
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .month-cell {
        min-height: 60px;
        padding: 4px;
    }
    
    .month-day-number {
        font-size: 0.65rem;
    }
    
    .appointment-count-badge {
        font-size: 0.55rem;
        padding: 1px 4px;
    }
}

/* ========== PATIENTS PAGE RESPONSIVE ========== */

@media (max-width: 1024px) {
    .vet-table {
        min-width: 800px;
    }
    
    .table-container {
        overflow-x: auto;
    }
}

@media (max-width: 768px) {
    .filter-section {
        flex-direction: column;
    }
    
    .table-search {
        width: 100%;
    }
    
    .filter-chips {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .chip {
        font-size: 0.75rem;
        padding: 6px 12px;
    }
    
    .status-tabs {
        width: 100%;
        justify-content: center;
    }
    
    .status-tab {
        font-size: 0.75rem;
        padding: 6px 12px;
    }
    
    .bulk-actions {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .bulk-buttons {
        justify-content: center;
    }
}

/* Patient Profile Page */
@media (max-width: 1024px) {
    .profile-layout {
        flex-direction: column;
    }
    
    .profile-left-column {
        flex: auto;
        width: 100%;
    }
}

@media (max-width: 768px) {
    .profile-card {
        padding: 20px;
    }
    
    .pet-photo-container {
        width: 100px;
        height: 100px;
    }
    
    .profile-name {
        font-size: 1.25rem;
    }
    
    .profile-info-list li {
        flex-direction: column;
        gap: 4px;
    }
    
    .profile-info-value {
        text-align: left;
    }
    
    .custom-tabs {
        flex-wrap: wrap;
    }
    
    .tab-item {
        flex: auto;
        font-size: 0.75rem;
        padding: 8px 12px;
    }
}

/* ========== MEDICAL RECORDS PAGE ========== */

@media (max-width: 768px) {
    .record-card {
        padding: 16px;
    }
    
    .record-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .vital-signs {
        align-self: flex-start;
    }
    
    .record-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .action-icons {
        align-self: flex-end;
    }
    
    .stats-row {
        flex-direction: column;
    }
    
    .stat-card {
        min-width: auto;
    }
}

/* ========== VACCINATIONS PAGE ========== */

@media (max-width: 1024px) {
    .card-details {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .vaccine-timeline {
        padding-left: 24px;
    }
    
    .vaccine-timeline::before {
        left: 8px;
    }
    
    .timeline-marker {
        left: -36px;
        width: 28px;
        height: 28px;
        font-size: 10px;
    }
    
    .vaccine-card {
        padding: 16px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .card-details {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .card-actions {
        flex-wrap: wrap;
    }
    
    .filter-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }
    
    .tab {
        white-space: nowrap;
    }
}

/* ========== SETTINGS PAGE ========== */

@media (max-width: 1024px) {
    .settings-container {
        grid-template-columns: 1fr;
    }
    
    .settings-menu {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        overflow-x: auto;
        padding: 12px;
    }
    
    .menu-item {
        flex: 1;
        min-width: 100px;
        justify-content: center;
        white-space: nowrap;
    }
}

@media (max-width: 768px) {
    .card-header {
        padding: 16px 20px;
    }
    
    .card-body {
        padding: 20px;
    }
    
    .profile-section {
        flex-direction: column;
        text-align: center;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* ========== MODAL RESPONSIVE ========== */

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-width: 95%;
        margin: 16px;
        max-height: 90vh;
    }
    
    .modal-header {
        padding: 16px;
    }
    
    .modal-body {
        padding: 16px;
    }
    
    .modal-footer {
        padding: 12px 16px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .form-actions {
        flex-direction: column-reverse;
    }
    
    .form-actions button {
        width: 100%;
    }
}

/* ========== NOTIFICATIONS MODAL ========== */

@media (max-width: 768px) {
    .notification-item {
        padding: 12px;
    }
    
    .notification-title {
        font-size: 0.8rem;
    }
    
    .notification-message {
        font-size: 0.7rem;
    }
    
    .notification-time {
        font-size: 0.6rem;
    }
}

/* ========== TABLES RESPONSIVE ========== */

@media (max-width: 768px) {
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 600px;
    }
    
    th, td {
        padding: 12px;
        font-size: 0.8rem;
    }
}

/* ========== FORMS RESPONSIVE ========== */

@media (max-width: 768px) {
    .form-group label {
        font-size: 0.8rem;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevents zoom on mobile */
        padding: 10px 12px;
    }
    
    input, select, textarea {
        font-size: 16px !important;
    }
}

/* ========== TOAST NOTIFICATIONS ========== */

@media (max-width: 768px) {
    .toast-notification {
        top: auto;
        bottom: 20px;
        left: 20px;
        right: 20px;
        max-width: none;
        width: auto;
    }
}

/* ========== BULK ACTIONS BAR ========== */

@media (max-width: 768px) {
    .bulk-actions-bar {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .bulk-buttons {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .bulk-buttons button {
        flex: 1;
    }
}

/* ========== SEARCH RESULTS DROPDOWN ========== */

@media (max-width: 768px) {
    .search-container {
        position: static;
    }
    
    #searchResults {
        position: fixed;
        top: auto;
        left: 16px;
        right: 16px;
        width: auto;
        max-height: 50vh;
        z-index: 1100;
    }
}

/* ========== DROPDOWN MENUS ========== */

@media (max-width: 768px) {
    .dropdown-menu {
        position: fixed;
        top: auto;
        right: 16px;
        bottom: auto;
        margin-top: 8px;
        max-width: calc(100vw - 32px);
    }
}

/* ========== PRINT STYLES ========== */

@media print {
    .sidebar,
    .top-header,
    .mobile-menu-toggle,
    .sidebar-overlay,
    .dropdown-menu,
    .notification-icon,
    .user-profile-header,
    .btn-primary,
    .btn-secondary,
    .action-buttons,
    .card-actions,
    .modal,
    .toast-notification {
        display: none !important;
    }
    
    .content {
        margin: 0 !important;
        padding: 0 !important;
    }
    
    .record-card,
    .appointment-card-large,
    .vaccine-card {
        break-inside: avoid;
        page-break-inside: avoid;
        border: 1px solid #ddd;
        margin-bottom: 16px;
    }
    
    body {
        background: white;
    }
}

/* ========== ANIMATIONS FOR RESPONSIVE ========== */

@media (max-width: 768px) {
    .sidebar {
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    .content {
        transition: padding 0.3s ease;
    }
    
    .mobile-menu-toggle {
        transition: all 0.2s ease;
    }
    
    .mobile-menu-toggle:active {
        transform: scale(0.95);
    }
}

/* ========== UTILITY CLASSES FOR RESPONSIVE ========== */

/* Hide on mobile */
@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Show on mobile only */
@media (min-width: 769px) {
    .show-mobile {
        display: none !important;
    }
}

/* Full width on mobile */
@media (max-width: 768px) {
    .full-width-mobile {
        width: 100% !important;
    }
}

/* Stack on mobile */
@media (max-width: 768px) {
    .stack-mobile {
        flex-direction: column !important;
    }
}

/* Center text on mobile */
@media (max-width: 768px) {
    .text-center-mobile {
        text-align: center !important;
    }
}