/* === CardSaaS Base Styles === */
body {
    background-color: #f5f7fa;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    -webkit-text-size-adjust: 100%;
}

.navbar-brand {
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Main container padding on mobile */
main.container-fluid {
    padding-left: 1rem;
    padding-right: 1rem;
}

/* Cards & Panels */
.card {
    border: none;
    box-shadow: 0 1px 6px rgba(0,0,0,.08);
    border-radius: 10px;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid #eee;
    font-weight: 600;
}

/* Stats Cards */
.stat-card {
    border-left: 4px solid;
    transition: transform 0.15s;
}
.stat-card:hover {
    transform: translateY(-2px);
}
.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
}
.stat-card .stat-label {
    color: #6c757d;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-primary { border-left-color: #0d6efd; }
.stat-success { border-left-color: #198754; }
.stat-warning { border-left-color: #ffc107; }
.stat-info    { border-left-color: #0dcaf0; }
.stat-danger  { border-left-color: #dc3545; }

/* Tables */
.table th {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: #6c757d;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
}

/* Forms */
.form-control:focus,
.form-select:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.2rem rgba(13,110,253,.15);
}

/* Auth Pages */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d6efd 0%, #6610f2 100%);
    padding: 1rem;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,.2);
}

.auth-card .card-body {
    padding: 2.5rem;
}

.auth-card h2 {
    font-weight: 700;
    color: #1a1a2e;
}

/* Badges */
.badge-role {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
}

/* Status badges */
.status-active {
    background-color: #d4edda;
    color: #155724;
}
.status-inactive {
    background-color: #f8d7da;
    color: #721c24;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #999;
}
.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Registration page */
.register-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #198754 0%, #0d6efd 100%);
    padding: 1rem;
}

.register-card {
    width: 100%;
    max-width: 550px;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0,0,0,.2);
}

.register-card .card-body {
    padding: 2.5rem;
}

/* ===== MOBILE CARD LIST (replaces tables on small screens) ===== */
.mobile-card-list {
    display: none;
}

.mobile-card-item {
    background: #fff;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.06);
    border: 1px solid #f0f0f0;
}

.mobile-card-item .mobile-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.mobile-card-item .mobile-card-header img {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.mobile-card-item .mobile-card-header .mobile-avatar-placeholder {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: #e9ecef;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #6c757d;
    font-size: 1.2rem;
}

.mobile-card-item .mobile-card-name {
    font-weight: 700;
    font-size: 1rem;
    color: #1a1a2e;
    margin: 0;
}

.mobile-card-item .mobile-card-subtitle {
    font-size: 0.85rem;
    color: #6c757d;
    margin: 0;
}

.mobile-card-item .mobile-card-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
}

.mobile-card-item .mobile-card-details .detail-label {
    color: #999;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.mobile-card-item .mobile-card-details .detail-value {
    color: #333;
}

.mobile-card-item .mobile-card-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding-top: 0.75rem;
    border-top: 1px solid #f0f0f0;
}

.mobile-card-item .mobile-card-actions .btn {
    flex: 1;
    min-width: 0;
}

/* Page header responsive */
.page-header-responsive {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.page-header-responsive h4 {
    margin: 0;
    font-size: 1.25rem;
}

/* ===== RESPONSIVE BREAKPOINTS ===== */

/* Tablet (768px and below) */
@media (max-width: 768px) {
    .auth-card .card-body,
    .register-card .card-body {
        padding: 1.5rem;
    }

    .stat-card .stat-value {
        font-size: 1.5rem;
    }

    .stat-card .stat-label {
        font-size: 0.75rem;
    }

    /* Stack stat cards 2 per row */
    .stat-card {
        margin-bottom: 0.5rem;
    }

    /* Page titles smaller */
    h4 {
        font-size: 1.15rem;
    }

    /* Filter form stack */
    .card .row.g-2 > [class*="col-md"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    /* Button group on mobile */
    .btn-group-sm .btn {
        padding: 0.35rem 0.5rem;
    }

    /* Company edit page: buttons wrap */
    .page-header-responsive .btn {
        font-size: 0.85rem;
        padding: 0.4rem 0.75rem;
    }
}

/* Mobile (576px and below) */
@media (max-width: 576px) {
    main.container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        padding-top: 1rem !important;
    }

    .auth-card .card-body,
    .register-card .card-body {
        padding: 1.25rem;
    }

    .auth-card h2,
    .register-card h2 {
        font-size: 1.4rem;
    }

    .auth-wrapper .display-4,
    .register-wrapper .display-4 {
        font-size: 2.5rem;
    }

    /* Stat cards: 2 per row */
    .row.g-3 > .col-md-3,
    .row.g-3 > .col-md-4 {
        flex: 0 0 50%;
        max-width: 50%;
    }

    .stat-card .stat-value {
        font-size: 1.3rem;
    }

    .stat-card .stat-label {
        font-size: 0.7rem;
    }

    .stat-card .card-body {
        padding: 0.75rem;
    }

    /* Hide desktop tables, show mobile cards */
    .desktop-table {
        display: none !important;
    }

    .mobile-card-list {
        display: block;
    }

    /* Card headers on mobile */
    .card-header {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }

    .card-header .btn {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }

    /* Page header */
    .page-header-responsive {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-header-responsive .btn {
        width: 100%;
        text-align: center;
    }

    /* Filter forms */
    .filter-card .card-body {
        padding: 0.75rem;
    }

    /* Navbar on mobile */
    .navbar-nav .nav-link {
        padding: 0.6rem 0;
        border-bottom: 1px solid rgba(255,255,255,.1);
    }

    .navbar .dropdown-toggle small {
        display: none;
    }

    /* Modal full width on mobile */
    .modal-dialog {
        margin: 0.5rem;
    }

    /* Pagination smaller */
    .pagination .page-link {
        padding: 0.35rem 0.65rem;
        font-size: 0.85rem;
    }

    /* Alert */
    .alert {
        font-size: 0.9rem;
        padding: 0.75rem;
    }

    /* Settings page: stack columns */
    .settings-grid .col-md-6 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* Very small phones (360px and below) */
@media (max-width: 360px) {
    .row.g-3 > .col-md-3,
    .row.g-3 > .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .stat-card .stat-value {
        font-size: 1.5rem;
    }

    .mobile-card-item .mobile-card-details {
        grid-template-columns: 1fr;
    }

    .auth-card .card-body,
    .register-card .card-body {
        padding: 1rem;
    }
}
