/* Proly SaaS - Responsive Styles */

/* ================================
   Mobile Navigation
   ================================ */

/* Sidebar overlay on mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 40;
}

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

/* Mobile menu button */
.mobile-menu-btn {
    display: none;
}

@media (max-width: 1023px) {
    .mobile-menu-btn {
        display: flex;
    }

    /* Sidebar hidden by default on mobile */
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* Main content full width on mobile */
    .main-content {
        margin-left: 0 !important;
    }
}

/* ================================
   Header Responsive
   ================================ */

@media (max-width: 767px) {
    .header-actions {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .header-actions > * {
        flex-shrink: 0;
    }

    /* Credits badges - smaller on mobile */
    .credits-badge {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    .credits-badge span:last-child {
        display: none;
    }
}

/* ================================
   Table Responsive
   ================================ */

/* Card view for tables on mobile */
@media (max-width: 1023px) {
    .responsive-table {
        display: block;
    }

    .responsive-table thead {
        display: none;
    }

    .responsive-table tbody {
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .responsive-table tr {
        display: block;
        background: white;
        border-radius: 0.75rem;
        padding: 1rem;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }

    .responsive-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border-bottom: 1px solid #f3f4f6;
    }

    .responsive-table td:last-child {
        border-bottom: none;
    }

    .responsive-table td::before {
        content: attr(data-label);
        font-weight: 500;
        color: #6b7280;
        font-size: 0.875rem;
    }

    /* First column (checkbox) */
    .responsive-table td:first-child {
        position: absolute;
        top: 1rem;
        right: 1rem;
    }

    .responsive-table td:first-child::before {
        display: none;
    }
}

/* ================================
   Forms Responsive
   ================================ */

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

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar > * {
        width: 100%;
    }
}

/* ================================
   Buttons Responsive
   ================================ */

@media (max-width: 767px) {
    .btn-group {
        flex-direction: column;
        width: 100%;
    }

    .btn-group > button,
    .btn-group > a {
        width: 100%;
        justify-content: center;
    }

    /* Icon only buttons on very small screens */
    .btn-responsive .btn-text {
        display: none;
    }

    .btn-responsive {
        padding: 0.5rem 0.75rem;
    }
}

@media (min-width: 768px) {
    .btn-responsive .btn-text {
        display: inline;
    }
}

/* ================================
   Cards & Stats Responsive
   ================================ */

@media (max-width: 639px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .stats-card {
        padding: 1rem;
    }

    .stats-card .text-3xl {
        font-size: 1.5rem;
    }
}

/* ================================
   Modals Responsive
   ================================ */

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

    .modal-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ================================
   Charts Responsive
   ================================ */

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

    .charts-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ================================
   Pagination Responsive
   ================================ */

@media (max-width: 639px) {
    .pagination {
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
    }

    .pagination-info {
        order: 2;
    }

    .pagination-controls {
        order: 1;
    }
}

/* ================================
   Quick Actions Responsive
   ================================ */

@media (max-width: 639px) {
    .quick-actions-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .quick-action-item {
        padding: 1rem;
    }

    .quick-action-item i {
        font-size: 1.25rem;
    }

    .quick-action-item span {
        font-size: 0.75rem;
    }
}

/* ================================
   Spacing Adjustments
   ================================ */

@media (max-width: 767px) {
    .content-padding {
        padding: 1rem !important;
    }

    .header-padding {
        padding: 1rem !important;
    }
}

/* ================================
   Typography Responsive
   ================================ */

@media (max-width: 639px) {
    .page-title {
        font-size: 1.25rem;
    }

    .section-title {
        font-size: 1rem;
    }
}

/* ================================
   Utility Classes
   ================================ */

/* Hide on mobile */
.hide-mobile {
    display: block;
}

@media (max-width: 767px) {
    .hide-mobile {
        display: none !important;
    }
}

/* Show only on mobile */
.show-mobile {
    display: none;
}

@media (max-width: 767px) {
    .show-mobile {
        display: block;
    }
}

/* Truncate text */
.truncate-mobile {
    max-width: 100%;
}

@media (max-width: 767px) {
    .truncate-mobile {
        max-width: 150px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

/* Scroll horizontal on mobile for wide content */
.scroll-x-mobile {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Safe area padding for mobile devices with notches */
@supports (padding: max(0px)) {
    .safe-area-bottom {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }

    .safe-area-top {
        padding-top: max(0px, env(safe-area-inset-top));
    }
}
