/* ============================================
   RESPONSIVE COMPONENTS CSS
   AIGOS - AI Growth Operating System
   ============================================ */

/* ============================================
   RESPONSIVE CARDS
   ============================================ */

/* Mobile-first card grid */
.card-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media (min-width: 576px) {
    .card-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .card-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .card-grid-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Responsive card with image */
.card-responsive {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card-responsive .card-img-top {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

@media (min-width: 768px) {
    .card-horizontal {
        flex-direction: row;
    }
    
    .card-horizontal .card-img-top {
        width: 200px;
        height: auto;
    }
}

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

/* Horizontal scroll wrapper */
.table-scroll-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -1rem;
    padding: 0 1rem;
}

/* Stack table on mobile */
@media (max-width: 767px) {
    .table-stack {
        display: block;
    }
    
    .table-stack thead {
        display: none;
    }
    
    .table-stack tbody,
    .table-stack tr,
    .table-stack td {
        display: block;
    }
    
    .table-stack tr {
        margin-bottom: 1rem;
        background: rgba(45, 49, 66, 0.6);
        border-radius: 8px;
        padding: 1rem;
    }
    
    .table-stack td {
        text-align: right;
        padding: 0.5rem 0;
        position: relative;
        padding-left: 50%;
    }
    
    .table-stack td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        width: 45%;
        text-align: left;
        font-weight: 600;
        color: #9ca3af;
    }
}

/* Priority columns for responsive tables */
@media (max-width: 576px) {
    .priority-low {
        display: none;
    }
}

@media (max-width: 768px) {
    .priority-medium {
        display: none;
    }
}

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

/* Form grid */
.form-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .form-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Full span items */
.form-grid-full {
    grid-column: 1 / -1;
}

/* Inline form on desktop */
@media (min-width: 768px) {
    .form-inline-responsive {
        display: flex;
        gap: 1rem;
        align-items: flex-end;
    }
    
    .form-inline-responsive .form-group {
        flex: 1;
    }
    
    .form-inline-responsive .btn {
        flex-shrink: 0;
    }
}

/* Floating labels for mobile */
.form-floating-responsive {
    position: relative;
    margin-bottom: 1rem;
}

.form-floating-responsive input,
.form-floating-responsive textarea,
.form-floating-responsive select {
    padding-top: 1.5rem;
    padding-bottom: 0.5rem;
}

.form-floating-responsive label {
    position: absolute;
    top: 0;
    left: 1rem;
    font-size: 0.75rem;
    color: #9ca3af;
    transition: all 0.2s ease;
}

.form-floating-responsive input:placeholder-shown + label {
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
}

.form-floating-responsive input:focus + label,
.form-floating-responsive input:not(:placeholder-shown) + label {
    top: 0.25rem;
    transform: translateY(0);
    font-size: 0.75rem;
    color: #ff8a3d;
}

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

/* Full screen modal on mobile */
@media (max-width: 576px) {
    .modal-fullscreen-mobile .modal-dialog {
        margin: 0;
        max-width: 100%;
        width: 100%;
        height: 100%;
    }
    
    .modal-fullscreen-mobile .modal-content {
        height: 100%;
        border-radius: 0;
    }
}

/* Bottom sheet modal */
.modal-bottom-sheet .modal-dialog {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    max-width: 100%;
}

.modal-bottom-sheet .modal-content {
    border-radius: 1rem 1rem 0 0;
    max-height: 90vh;
    overflow-y: auto;
}

/* Drawer modal */
.modal-drawer-left .modal-dialog,
.modal-drawer-right .modal-dialog {
    position: fixed;
    margin: 0;
    height: 100%;
    max-width: 320px;
    width: 80%;
}

.modal-drawer-left .modal-dialog {
    left: 0;
    transform: translateX(-100%);
}

.modal-drawer-right .modal-dialog {
    right: 0;
    transform: translateX(100%);
}

.modal-drawer-left.show .modal-dialog,
.modal-drawer-right.show .modal-dialog {
    transform: translateX(0);
}

/* ============================================
   RESPONSIVE NAVIGATION
   ============================================ */

/* Bottom navigation for mobile */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(45, 49, 66, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    z-index: 1000;
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    color: #9ca3af;
    text-decoration: none;
    transition: color 0.2s ease;
}

.bottom-nav-item.active {
    color: #ff8a3d;
}

.bottom-nav-item i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
}

.bottom-nav-item span {
    font-size: 0.75rem;
}

@media (min-width: 768px) {
    .bottom-nav {
        display: none;
    }
}

/* Tab navigation responsive */
.nav-tabs-responsive {
    display: flex;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.nav-tabs-responsive::-webkit-scrollbar {
    display: none;
}

.nav-tabs-responsive .nav-link {
    flex-shrink: 0;
    white-space: nowrap;
}

/* ============================================
   RESPONSIVE IMAGES
   ============================================ */

/* Responsive image container */
.img-responsive-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* Aspect ratio boxes */
.aspect-ratio-16-9 {
    padding-bottom: 56.25%;
}

.aspect-ratio-4-3 {
    padding-bottom: 75%;
}

.aspect-ratio-1-1 {
    padding-bottom: 100%;
}

.aspect-ratio-3-2 {
    padding-bottom: 66.67%;
}

.img-responsive-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Responsive gallery */
.gallery-responsive {
    display: grid;
    gap: 0.5rem;
    grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 576px) {
    .gallery-responsive {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) {
    .gallery-responsive {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 1024px) {
    .gallery-responsive {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* ============================================
   RESPONSIVE BUTTONS
   ============================================ */

/* Button group responsive */
.btn-group-responsive {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

@media (min-width: 576px) {
    .btn-group-responsive {
        flex-direction: row;
    }
}

/* Floating action button */
.fab {
    position: fixed;
    bottom: 5rem;
    right: 1rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff8a3d 0%, #e07428 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    z-index: 999;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.fab:active {
    transform: scale(0.95);
}

@media (min-width: 768px) {
    .fab {
        bottom: 2rem;
    }
}

/* ============================================
   RESPONSIVE ALERTS & TOASTS
   ============================================ */

/* Mobile-friendly alerts */
.alert-mobile {
    position: fixed;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    z-index: 1050;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Toast notifications */
.toast-container-responsive {
    position: fixed;
    bottom: 5rem;
    right: 1rem;
    z-index: 1050;
    max-width: calc(100% - 2rem);
}

@media (min-width: 768px) {
    .toast-container-responsive {
        bottom: 1rem;
        max-width: 320px;
    }
}

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

/* Chart container */
.chart-responsive {
    position: relative;
    width: 100%;
    height: 300px;
}

@media (min-width: 768px) {
    .chart-responsive {
        height: 400px;
    }
}

/* Make canvas responsive */
.chart-responsive canvas {
    max-width: 100%;
    height: auto !important;
}

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

/* Text alignment responsive */
.text-center-mobile {
    text-align: center;
}

@media (min-width: 768px) {
    .text-left-tablet {
        text-align: left;
    }
    
    .text-center-tablet {
        text-align: center;
    }
    
    .text-right-tablet {
        text-align: right;
    }
}

/* Spacing utilities responsive */
.p-mobile-2 {
    padding: 0.5rem;
}

.p-mobile-3 {
    padding: 1rem;
}

@media (min-width: 768px) {
    .p-tablet-4 {
        padding: 1.5rem;
    }
    
    .p-tablet-5 {
        padding: 2rem;
    }
}

/* Display utilities responsive */
.d-mobile-none {
    display: none;
}

.d-mobile-block {
    display: block;
}

@media (min-width: 768px) {
    .d-tablet-none {
        display: none;
    }
    
    .d-tablet-block {
        display: block;
    }
    
    .d-tablet-flex {
        display: flex;
    }
}

@media (min-width: 1024px) {
    .d-desktop-none {
        display: none;
    }
    
    .d-desktop-block {
        display: block;
    }
    
    .d-desktop-flex {
        display: flex;
    }
}

/* Flex utilities responsive */
.flex-mobile-column {
    flex-direction: column;
}

@media (min-width: 768px) {
    .flex-tablet-row {
        flex-direction: row;
    }
}

/* Order utilities responsive */
.order-mobile-1 {
    order: 1;
}

.order-mobile-2 {
    order: 2;
}

@media (min-width: 768px) {
    .order-tablet-1 {
        order: 1;
    }
    
    .order-tablet-2 {
        order: 2;
    }
}

/* ============================================
   LOADING STATES
   ============================================ */

/* Skeleton loader */
.skeleton {
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.1) 25%, 
        rgba(255, 255, 255, 0.2) 50%, 
        rgba(255, 255, 255, 0.1) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1rem;
    border-radius: 4px;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 2rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

.skeleton-card {
    height: 200px;
    border-radius: 8px;
}

/* Spinner */
.spinner-responsive {
    width: 2rem;
    height: 2rem;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #ff8a3d;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}