/*
 * Pro4 Security CRM - Responsive & Elegant UI Styles
 * Mobile-first responsive design with elegant animations
 */

/* ========================================
   Global Responsive Utilities
   ======================================== */

/* Container optimizations */
@media (max-width: 575.98px) {
    .container,
    .container-fluid {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}

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

h1, .h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
}

h2, .h2 {
    font-size: clamp(1.5rem, 3.5vw, 2rem);
}

h3, .h3 {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
}

h4, .h4 {
    font-size: clamp(1.1rem, 2.5vw, 1.5rem);
}

/* ========================================
   Button Responsive Styles
   ======================================== */

.btn {
    transition: all 0.3s ease;
    border-radius: 8px;
    font-weight: 500;
}

@media (max-width: 575.98px) {
    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }
    
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Touch-friendly buttons */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

/* ========================================
   Card Responsive Styles
   ======================================== */

.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    margin-bottom: 1.5rem;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}

@media (max-width: 575.98px) {
    .card {
        border-radius: 8px;
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }
}

/* ========================================
   Form Responsive Styles
   ======================================== */

.form-control,
.form-select {
    border-radius: 8px;
    border: 2px solid #e9ecef;
    transition: all 0.3s ease;
}

.form-control:focus,
.form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

@media (max-width: 575.98px) {
    .form-control,
    .form-select {
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 0.65rem;
    }
    
    .form-label {
        font-size: 0.9rem;
        margin-bottom: 0.4rem;
    }
    
    .form-group {
        margin-bottom: 1rem;
    }
}

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

.table-responsive {
    border-radius: 8px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

@media (max-width: 767.98px) {
    .table {
        font-size: 0.85rem;
    }
    
    .table thead th,
    .table tbody td {
        padding: 0.5rem;
        white-space: nowrap;
    }
    
    /* Hide less important columns on mobile */
    .table .hide-mobile {
        display: none;
    }
}

/* ========================================
   Badge & Status Responsive
   ======================================== */

.badge {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    transition: transform 0.2s ease;
}

.badge:hover {
    transform: scale(1.05);
}

@media (max-width: 575.98px) {
    .badge {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }
}

/* ========================================
   Modal Responsive
   ======================================== */

@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-content {
        border-radius: 12px;
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
    
    .modal-title {
        font-size: 1.1rem;
    }
}

/* ========================================
   Navigation & Breadcrumb Responsive
   ======================================== */

.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 1rem;
}

@media (max-width: 575.98px) {
    .breadcrumb {
        font-size: 0.8rem;
        flex-wrap: wrap;
    }
    
    .breadcrumb-item {
        max-width: 100px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

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

.pagination {
    margin-top: 1.5rem;
    margin-bottom: 0;
}

@media (max-width: 575.98px) {
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .pagination .page-item {
        margin: 0.25rem;
    }
    
    .pagination .page-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }
}

/* ========================================
   Alert & Toast Responsive
   ======================================== */

.alert {
    border-radius: 8px;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

@media (max-width: 575.98px) {
    .alert {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

/* ========================================
   Animations & Transitions
   ======================================== */

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.4s ease-out;
}

/* Slide in from right */
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.animate-slide-in-right {
    animation: slideInRight 0.4s ease-out;
}

/* Pulse animation for important elements */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.animate-pulse {
    animation: pulse 2s infinite;
}

/* ========================================
   Utility Classes - Responsive Spacing
   ======================================== */

@media (max-width: 575.98px) {
    .p-mobile-0 { padding: 0 !important; }
    .p-mobile-1 { padding: 0.25rem !important; }
    .p-mobile-2 { padding: 0.5rem !important; }
    .p-mobile-3 { padding: 1rem !important; }
    
    .m-mobile-0 { margin: 0 !important; }
    .m-mobile-1 { margin: 0.25rem !important; }
    .m-mobile-2 { margin: 0.5rem !important; }
    .m-mobile-3 { margin: 1rem !important; }
    
    .gap-mobile-1 { gap: 0.25rem !important; }
    .gap-mobile-2 { gap: 0.5rem !important; }
    .gap-mobile-3 { gap: 1rem !important; }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .btn,
    .breadcrumb,
    .pagination,
    .navbar,
    .sidebar,
    .no-print {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
        page-break-inside: avoid;
    }
    
    body {
        font-size: 12pt;
        color: #000;
        background: white;
    }
    
    .table {
        border: 1px solid #000;
    }
    
    .table thead th {
        background-color: #f8f9fa !important;
        border: 1px solid #000;
    }
}

/* ========================================
   Dark Mode Support (Optional)
   ======================================== */

@media (prefers-color-scheme: dark) {
    :root {
        --bs-body-bg: #1a202c;
        --bs-body-color: #e2e8f0;
    }
    
    .card {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .form-control,
    .form-select {
        background: #1a202c;
        color: #e2e8f0;
        border-color: #4a5568;
    }
    
    .table {
        color: #e2e8f0;
    }
    
    .table thead th {
        background-color: #2d3748;
        border-color: #4a5568;
    }
    
    .table tbody tr:hover {
        background-color: #2d3748;
    }
}

/* ========================================
   Accessibility Improvements
   ======================================== */

/* Focus styles for keyboard navigation */
*:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* Skip to main content link */
.skip-to-main {
    position: absolute;
    top: -40px;
    left: 0;
    background: #667eea;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-main:focus {
    top: 0;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ========================================
   Performance Optimizations
   ======================================== */

/* Hardware acceleration for animations */
.card,
.btn,
.modal {
    will-change: transform;
    transform: translateZ(0);
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

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