/**
 * Calibr8ted Responsive Styles
 * Mobile-first responsive design system
 *
 * Breakpoints:
 * - Mobile: < 480px
 * - Tablet: 481px - 768px
 * - Desktop: 769px - 1024px
 * - Large: > 1024px
 */

/* ==========================================
   BASE RESPONSIVE UTILITIES
   ========================================== */

/* Hide on specific sizes */
@media (max-width: 480px) {
    .hide-mobile { display: none !important; }
}
@media (min-width: 481px) and (max-width: 768px) {
    .hide-tablet { display: none !important; }
}
@media (min-width: 769px) {
    .hide-desktop { display: none !important; }
}

/* Show only on specific sizes */
.show-mobile { display: none !important; }
.show-tablet { display: none !important; }
@media (max-width: 480px) {
    .show-mobile { display: block !important; }
}
@media (min-width: 481px) and (max-width: 768px) {
    .show-tablet { display: block !important; }
}

/* ==========================================
   NAVIGATION - MOBILE
   ========================================== */

@media (max-width: 768px) {
    .navbar {
        padding: 0.75rem 1rem;
    }

    .navbar-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: rgba(10, 10, 10, 0.98);
        flex-direction: column;
        padding: 1rem;
        border-top: 1px solid rgba(147, 220, 58, 0.2);
    }

    .navbar-links.active {
        display: flex;
    }

    .navbar-links a {
        padding: 0.75rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .nav-buttons {
        display: none;
    }

    .nav-buttons.active {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        padding: 1rem;
    }

    .mobile-menu-btn {
        display: flex !important;
        flex-direction: column;
        gap: 4px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 0.5rem;
    }

    .mobile-menu-btn span {
        display: block;
        width: 24px;
        height: 2px;
        background: #93DC3A;
        transition: transform 0.3s, opacity 0.3s;
    }

    .mobile-menu-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(4px, 4px);
    }
    .mobile-menu-btn.active span:nth-child(2) {
        opacity: 0;
    }
    .mobile-menu-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(4px, -4px);
    }
}

/* ==========================================
   HERO SECTION - RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .hero-section {
        padding: 6rem 1rem 4rem;
        min-height: auto;
    }

    .hero-headline {
        font-size: 2.5rem !important;
        line-height: 1.2;
        margin-bottom: 1rem;
    }

    .hero-subheadline {
        font-size: 1.1rem;
        margin-bottom: 2rem;
    }

    .hero-cta-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }

    .hero-cta-buttons .btn {
        width: 100%;
        text-align: center;
    }

    .hero-video {
        margin-top: 2rem;
        border-radius: 8px;
    }
}

@media (max-width: 480px) {
    .hero-headline {
        font-size: 2rem !important;
    }

    .hero-subheadline {
        font-size: 1rem;
    }
}

/* ==========================================
   CARDS & GRIDS - RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .card-grid,
    .property-grid,
    .features-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    .card {
        padding: 1.25rem;
    }

    .stat-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .stat-cards {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 1rem;
    }

    .card-title {
        font-size: 1.1rem;
    }
}

/* ==========================================
   DASHBOARD - RESPONSIVE
   ========================================== */

@media (max-width: 1024px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 280px;
        z-index: 1000;
        transition: left 0.3s ease;
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }

    .sidebar.active + .sidebar-overlay {
        display: block;
    }

    .main-content {
        margin-left: 0;
        padding: 1rem;
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .dashboard-header h1 {
        font-size: 1.5rem;
    }

    .action-buttons {
        width: 100%;
        flex-wrap: wrap;
    }

    .action-buttons .btn {
        flex: 1;
        min-width: 120px;
    }
}

/* ==========================================
   TABLES - RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 600px;
    }

    /* Card-style table for very small screens */
    .table-responsive-cards thead {
        display: none;
    }

    .table-responsive-cards tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: 8px;
        padding: 1rem;
    }

    .table-responsive-cards tbody td {
        display: flex;
        justify-content: space-between;
        padding: 0.5rem 0;
        border: none;
    }

    .table-responsive-cards tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #93DC3A;
    }
}

/* ==========================================
   FORMS - RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .form-row {
        flex-direction: column;
        gap: 1rem;
    }

    .form-group {
        width: 100%;
    }

    input, select, textarea {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    .form-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .form-actions .btn {
        width: 100%;
    }
}

/* ==========================================
   MODALS - RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }

    .modal-footer {
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .modal-footer .btn {
        width: 100%;
    }
}

/* ==========================================
   FOOTER - RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .footer-content {
        grid-template-columns: 1fr 1fr !important;
        gap: 2rem;
    }

    .footer-section {
        text-align: left;
    }
}

@media (max-width: 480px) {
    .footer-content {
        grid-template-columns: 1fr !important;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
}

/* ==========================================
   PROPERTY DETAIL - RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .property-header {
        flex-direction: column;
        gap: 1rem;
    }

    .property-gallery {
        grid-template-columns: 1fr;
    }

    .property-info-grid {
        grid-template-columns: 1fr;
    }

    .pricing-calendar {
        overflow-x: auto;
    }

    .calendar-grid {
        min-width: 320px;
    }
}

/* ==========================================
   CHARTS - RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .chart-container {
        height: 250px !important;
    }

    .chart-legend {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ==========================================
   BUTTONS - TOUCH FRIENDLY
   ========================================== */

@media (max-width: 768px) {
    .btn {
        min-height: 44px; /* Apple's recommended touch target */
        padding: 0.75rem 1.25rem;
    }

    .btn-sm {
        min-height: 36px;
        padding: 0.5rem 1rem;
    }

    .btn-icon {
        min-width: 44px;
        min-height: 44px;
    }
}

/* ==========================================
   TYPOGRAPHY - RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }

    p, li {
        font-size: 0.95rem;
        line-height: 1.6;
    }
}

@media (max-width: 480px) {
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.35rem; }
    h3 { font-size: 1.15rem; }
}

/* ==========================================
   SPACING - RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .section {
        padding: 3rem 1rem;
    }

    .container {
        padding: 0 1rem;
    }

    .mb-4 { margin-bottom: 1.5rem; }
    .mb-5 { margin-bottom: 2rem; }
    .py-5 { padding-top: 2rem; padding-bottom: 2rem; }
}

/* ==========================================
   ADMIN DASHBOARD SPECIFIC
   ========================================== */

@media (max-width: 1200px) {
    .admin-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .admin-nav {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 0.5rem;
    }

    .admin-nav a {
        display: inline-block;
    }

    .property-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .tool-buttons {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .tool-buttons .btn {
        flex: 1;
        min-width: 100px;
        font-size: 0.85rem;
    }
}

/* ==========================================
   ANIMATIONS - REDUCED MOTION
   ========================================== */

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

    .fingerprint-particle {
        animation: none !important;
    }
}

/* ==========================================
   PRINT STYLES
   ========================================== */

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */

.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: rgba(30, 30, 30, 0.95);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
    max-width: 350px;
}

.toast-success { border-left: 4px solid #93DC3A; }
.toast-error { border-left: 4px solid #DA0000; }
.toast-warning { border-left: 4px solid #F4D532; }
.toast-info { border-left: 4px solid #4A90D9; }

.toast-close {
    background: none;
    border: none;
    color: #888;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.toast-close:hover {
    color: #fff;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .toast-container {
        left: 1rem;
        right: 1rem;
    }

    .toast {
        max-width: none;
    }
}

/* ==========================================
   BODY STATES
   ========================================== */

body.menu-open {
    overflow: hidden;
}

/* ==========================================
   PRINT STYLES
   ========================================== */

@media print {
    .navbar,
    .sidebar,
    .footer,
    .btn,
    .mobile-menu-btn,
    .fingerprint-background {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }

    .card {
        border: 1px solid #ccc;
        box-shadow: none;
    }
}
