/* Mobile-Responsive Styles for Quemi Dashboard and Video Conference */
/* Inspired by Monday.com's clean, modern design */

/* ============================================ */
/* BASE STYLES & VARIABLES */
/* ============================================ */
:root {
    --primary-color: #0073ea;
    --secondary-color: #676879;
    --success-color: #00ca72;
    --warning-color: #fdab3d;
    --danger-color: #e44258;
    --info-color: #5559df;
    --light-bg: #f6f7fb;
    --dark-text: #323338;
    --border-radius: 8px;
    --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --card-hover-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s ease;
}

/* ============================================ */
/* CONTAINER & LAYOUT */
/* ============================================ */
.container {
    padding-left: 16px;
    padding-right: 16px;
}

@media (min-width: 768px) {
    .container {
        padding-left: 24px;
        padding-right: 24px;
    }
}

/* ============================================ */
/* CARD COMPONENTS */
/* ============================================ */
.card,
.video-conference-card,
.secured-container {
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    border: 1px solid #e6e9ef;
    margin-bottom: 16px;
    background: white;
    transition: var(--transition);
}

.card:hover,
.video-conference-card:hover {
    box-shadow: var(--card-hover-shadow);
}

.card-header {
    padding: 16px;
    background: white;
    border-bottom: 2px solid #f6f7fb;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.card-body {
    padding: 16px;
}

@media (min-width: 768px) {
    .card-header {
        padding: 20px 24px;
    }
    
    .card-body {
        padding: 24px;
    }
}

/* ============================================ */
/* DASHBOARD STATISTICS CARDS */
/* ============================================ */
.row {
    margin-left: -8px;
    margin-right: -8px;
}

.row > [class*='col-'] {
    padding-left: 8px;
    padding-right: 8px;
}

@media (max-width: 767px) {
    .col-md-3,
    .col-md-4,
    .col-md-6,
    .col-md-8 {
        width: 100%;
        margin-bottom: 12px;
    }
    
    /* Stack cards on mobile */
    .mb-4 {
        margin-bottom: 12px !important;
    }
}

/* Stat cards */
.card .card-body h5.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--secondary-color);
    margin-bottom: 8px;
}

.card .card-body h2.card-text {
    font-size: 32px;
    font-weight: 700;
    color: var(--dark-text);
    margin-bottom: 4px;
}

.card .card-body small.text-muted {
    font-size: 12px;
    color: var(--secondary-color);
}

@media (max-width: 767px) {
    .card .card-body h2.card-text {
        font-size: 24px;
    }
}

/* ============================================ */
/* BUTTONS */
/* ============================================ */
.btn {
    border-radius: 6px;
    font-weight: 600;
    padding: 10px 20px;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #0060c2;
    transform: translateY(-1px);
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #00a85c;
    transform: translateY(-1px);
}

.btn-warning {
    background-color: var(--warning-color);
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 14px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

@media (max-width: 767px) {
    .btn {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .btn-lg {
        padding: 12px 20px;
        font-size: 15px;
    }
    
    /* Don't stretch small buttons */
    .btn-sm {
        width: auto;
        display: inline-block;
    }
    
    /* Flex container buttons */
    .d-flex .btn,
    .d-grid .btn {
        width: 100%;
    }
    
    .gap-2 {
        flex-direction: column !important;
    }
}

/* ============================================ */
/* DATA GRIDS & TABLES */
/* ============================================ */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 16px;
}

@media (max-width: 767px) {
    /* Hide less important columns on mobile */
    .table thead th:nth-child(n+4),
    .table tbody td:nth-child(n+4) {
        display: none;
    }
    
    .table {
        font-size: 14px;
    }
    
    .table thead th,
    .table tbody td {
        padding: 8px 4px;
        white-space: nowrap;
    }
    
    /* Make Radzen grids scrollable */
    .rz-datatable {
        overflow-x: auto;
    }
    
    .rz-datatable-data {
        font-size: 14px;
    }
}

/* Mobile-optimized table view */
@media (max-width: 576px) {
    .table thead {
        display: none;
    }
    
    .table tbody tr {
        display: block;
        margin-bottom: 16px;
        border: 1px solid #e6e9ef;
        border-radius: var(--border-radius);
        padding: 12px;
        background: white;
    }
    
    .table tbody td {
        display: flex;
        justify-content: space-between;
        padding: 8px 0;
        border: none;
        white-space: normal;
    }
    
    .table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        margin-right: 12px;
        color: var(--secondary-color);
    }
}

/* ============================================ */
/* BADGES & STATUS INDICATORS */
/* ============================================ */
.badge {
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 767px) {
    .badge {
        font-size: 11px;
        padding: 3px 6px;
    }
}

/* ============================================ */
/* VIDEO CONFERENCE ROOM */
/* ============================================ */
.video-room {
    background: #000;
    border-radius: var(--border-radius);
    padding: 16px;
    min-height: 300px;
    position: relative;
    overflow: hidden;
}

@media (min-width: 768px) {
    .video-room {
        min-height: 500px;
        padding: 24px;
    }
}

#local-media,
#remote-media {
    width: 100%;
    border-radius: var(--border-radius);
}

#local-media {
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 120px;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

@media (max-width: 767px) {
    #local-media {
        width: 80px;
        bottom: 12px;
        right: 12px;
    }
}

/* Video controls */
.video-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 16px;
}

@media (max-width: 767px) {
    .video-controls .btn {
        flex: 1;
        min-width: 100px;
        max-width: 150px;
    }
}

/* ============================================ */
/* VIDEO CONFERENCE PARTICIPANT CARD */
/* ============================================ */
.video-call-card {
    background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
    border-radius: 20px;
    padding: 32px 24px;
    text-align: center;
    color: white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    max-width: 400px;
    margin: 0 auto;
}

.video-call-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.3);
    margin: 0 auto 20px;
    object-fit: cover;
}

.video-call-name {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.video-call-number {
    font-size: 18px;
    margin-bottom: 24px;
    opacity: 0.9;
}

.video-call-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    margin-bottom: 32px;
}

.video-call-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #00ca72;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Video action buttons in circular layout */
.video-call-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 24px;
}

.video-action-btn {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.4);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    transition: var(--transition);
    cursor: pointer;
}

.video-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.video-action-btn i {
    margin-bottom: 4px;
}

.video-action-btn span {
    font-size: 10px;
    font-weight: 600;
}

.video-action-btn.end-call {
    background: var(--danger-color);
    border-color: var(--danger-color);
}

.video-action-btn.end-call:hover {
    background: #c63a50;
}

@media (max-width: 767px) {
    .video-call-card {
        padding: 24px 16px;
        border-radius: 16px;
    }
    
    .video-call-avatar {
        width: 100px;
        height: 100px;
    }
    
    .video-call-name {
        font-size: 20px;
    }
    
    .video-call-number {
        font-size: 16px;
    }
    
    .video-action-btn {
        width: 56px;
        height: 56px;
        font-size: 18px;
    }
}

/* ============================================ */
/* ALERTS & NOTIFICATIONS */
/* ============================================ */
.alert {
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 16px;
    border: none;
}

.alert-info {
    background-color: #e3f2fd;
    color: #0d47a1;
}

.alert-warning {
    background-color: #fff3e0;
    color: #e65100;
}

.alert-success {
    background-color: #e8f5e9;
    color: #1b5e20;
}

.alert-danger {
    background-color: #ffebee;
    color: #b71c1c;
}

/* ============================================ */
/* FORMS & INPUTS */
/* ============================================ */
.form-control,
.form-select {
    border-radius: 6px;
    border: 1px solid #c5c7d0;
    padding: 10px 12px;
    font-size: 15px;
    transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 115, 234, 0.1);
}

.form-label {
    font-weight: 600;
    color: var(--dark-text);
    margin-bottom: 8px;
    font-size: 14px;
}

/* ============================================ */
/* EXPANDABLE CONFERENCE DETAILS */
/* ============================================ */
.conference-expandable {
    transition: max-height 0.3s ease;
    overflow: hidden;
}

@media (max-width: 767px) {
    .conference-expandable .row {
        flex-direction: column;
    }
    
    .conference-expandable .col-md-4,
    .conference-expandable .col-md-8 {
        width: 100%;
        margin-bottom: 16px;
    }
}

/* ============================================ */
/* HEADER & NAVIGATION IMPROVEMENTS */
/* ============================================ */
h3, h4, h5, h6 {
    color: var(--dark-text);
    font-weight: 700;
}

@media (max-width: 767px) {
    h3 {
        font-size: 20px;
    }
    
    h4 {
        font-size: 18px;
    }
    
    h5 {
        font-size: 16px;
    }
    
    /* Header with buttons - stack on mobile */
    .card-header.d-flex {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 12px;
    }
    
    .card-header .btn {
        width: 100%;
    }
}

/* ============================================ */
/* SPINNER & LOADING STATES */
/* ============================================ */
.spinner-border {
    width: 2rem;
    height: 2rem;
}

@media (max-width: 767px) {
    .spinner-border {
        width: 1.5rem;
        height: 1.5rem;
    }
}

/* ============================================ */
/* CHARTS (Radzen) */
/* ============================================ */
.rz-chart {
    height: 300px;
}

@media (max-width: 767px) {
    .rz-chart {
        height: 250px;
    }
}

/* ============================================ */
/* UTILITY CLASSES */
/* ============================================ */
.text-center {
    text-align: center;
}

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 3rem !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 3rem !important; }

@media (max-width: 767px) {
    /* Reduce spacing on mobile */
    .mb-4 { margin-bottom: 1rem !important; }
    .mb-5 { margin-bottom: 2rem !important; }
    .mt-4 { margin-top: 1rem !important; }
    .mt-5 { margin-top: 2rem !important; }
}

/* ============================================ */
/* PROFILE PICTURES & AVATARS */
/* ============================================ */
.avatar-xs {
    width: 32px;
    height: 32px;
    font-size: 14px;
}

.avatar-md {
    width: 64px;
    height: 64px;
    font-size: 24px;
}

.avatar-lg {
    width: 96px;
    height: 96px;
    font-size: 36px;
}

.avatar-title {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.rounded-circle {
    border-radius: 50% !important;
}

/* ============================================ */
/* IMPROVED TOUCH TARGETS FOR MOBILE */
/* ============================================ */
@media (max-width: 767px) {
    a, button, .btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Clickable rows */
    tbody tr[style*="cursor: pointer"] {
        cursor: pointer;
        padding: 12px 8px;
    }
}

/* ============================================ */
/* SMOOTH SCROLLING */
/* ============================================ */
html {
    scroll-behavior: smooth;
}

/* ============================================ */
/* ACCESSIBILITY IMPROVEMENTS */
/* ============================================ */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* ============================================ */
/* DARK MODE SUPPORT (Optional) */
/* ============================================ */
@media (prefers-color-scheme: dark) {
    :root {
        --light-bg: #1f2937;
        --dark-text: #f9fafb;
        --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
    
    .card,
    .video-conference-card {
        background: #374151;
        border-color: #4b5563;
    }
    
    .card-header {
        background: #374151;
        border-bottom-color: #4b5563;
    }
}
