/* ==========================================
   ADMIN COMPONENTS - UI/UX OPTIMIZATIONS
   Best practices for Metronic components
   ========================================== */

/* ==========================================
   CARDS & WIDGETS
   ========================================== */

/* Card Base - Subtle Shadows and Hover */
.card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 0;
    box-shadow: 0 0 20px 0 rgba(76, 87, 125, 0.08);
}

.card:hover {
    box-shadow: 0 0 30px 0 rgba(76, 87, 125, 0.12);
    transform: translateY(-2px);
}

/* Card Header - Better Typography */
.card-header {
    border-bottom: 1px solid #E4E6EF;
    padding: 1.5rem;
}

.card-title {
    font-weight: 600;
    color: #181C32;
}

.card-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: #181C32;
}

/* Card Body - Better Spacing */
.card-body {
    padding: 1.5rem;
}

/* Card Footer - Subtle Border */
.card-footer {
    border-top: 1px solid #E4E6EF;
    background-color: #F9F9F9;
}

/* ==========================================
   TABLES & DATATABLES
   ========================================== */

/* Table Base - Better Spacing */
.table {
    margin-bottom: 0;
}

.table thead th {
    font-weight: 600;
    color: #7E8299;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    border-bottom: 2px solid #E4E6EF;
    padding: 1rem 0.75rem;
}

.table tbody td {
    padding: 1rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid #F1F1F2;
}

/* Table Row Hover - Subtle */
.table tbody tr {
    transition: all 0.2s ease;
}

.table tbody tr:hover {
    background-color: #F9F9F9;
}

/* Table Striped - Better Contrast */
.table-striped tbody tr:nth-of-type(odd) {
    background-color: #FAFAFB;
}

.table-striped tbody tr:nth-of-type(odd):hover {
    background-color: #F5F5F6;
}

/* Table Actions - Better Spacing */
.table-actions {
    white-space: nowrap;
}

.table-actions .btn {
    margin: 0 0.25rem;
    padding: 0.5rem 0.75rem;
}

/* Responsive Tables - Cards on Mobile */
@media (max-width: 767px) {
    .table-responsive {
        border: 0;
    }

    .table thead {
        display: none;
    }

    .table tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #E4E6EF;
        border-radius: 0.475rem;
        padding: 1rem;
        background: #fff;
    }

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

    .table tbody td:last-child {
        border-bottom: 0;
    }

    .table tbody td:before {
        content: attr(data-label);
        font-weight: 600;
        color: #7E8299;
        text-transform: uppercase;
        font-size: 0.75rem;
    }
}

/* Empty State - Tables */
.table-empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #7E8299;
}

.table-empty-state svg {
    width: 120px;
    height: 120px;
    margin-bottom: 1.5rem;
    opacity: 0.5;
}

.table-empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #181C32;
    margin-bottom: 0.5rem;
}

.table-empty-state p {
    color: #7E8299;
    margin-bottom: 1.5rem;
}

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

/* Form Labels - Better Typography */
.form-label {
    font-weight: 600;
    color: #181C32;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-label.required:after {
    content: ' *';
    color: #F1416C;
}

/* Form Controls - Better Focus States */
.form-control,
.form-select {
    border: 1px solid #E4E6EF;
    border-radius: 0.475rem;
    padding: 0.75rem 1rem;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.form-control:focus,
.form-select:focus {
    border-color: #3699FF;
    box-shadow: 0 0 0 0.25rem rgba(54, 153, 255, 0.1);
    outline: 0;
}

.form-control:disabled,
.form-select:disabled {
    background-color: #F5F8FA;
    opacity: 0.6;
    cursor: not-allowed;
}

/* Form Control Sizes */
.form-control-lg {
    padding: 1rem 1.25rem;
    font-size: 1rem;
}

.form-control-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
}

/* Invalid States */
.form-control.is-invalid,
.form-select.is-invalid {
    border-color: #F1416C;
}

.form-control.is-invalid:focus,
.form-select.is-invalid:focus {
    border-color: #F1416C;
    box-shadow: 0 0 0 0.25rem rgba(241, 65, 108, 0.1);
}

.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #F1416C;
    font-weight: 500;
}

/* Valid States */
.form-control.is-valid,
.form-select.is-valid {
    border-color: #50CD89;
}

.form-control.is-valid:focus,
.form-select.is-valid:focus {
    border-color: #50CD89;
    box-shadow: 0 0 0 0.25rem rgba(80, 205, 137, 0.1);
}

.valid-feedback {
    display: block;
    width: 100%;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #50CD89;
    font-weight: 500;
}

/* Help Text */
.form-text {
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #7E8299;
}

/* Input Groups */
.input-group-text {
    background-color: #F5F8FA;
    border: 1px solid #E4E6EF;
    color: #7E8299;
}

/* ==========================================
   BUTTONS - ENHANCED STATES
   ========================================== */

/* Button Loading State */
.btn[data-kt-indicator="on"] {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn[data-kt-indicator="on"]:after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner 0.6s linear infinite;
}

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

/* Button Disabled State */
.btn:disabled,
.btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Button Groups */
.btn-group .btn {
    margin: 0;
}

.btn-group .btn:not(:first-child):not(:last-child) {
    border-radius: 0;
}

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

/* Modal Backdrop - Smoother */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

/* Modal Content - Better Shadows */
.modal-content {
    border: 0;
    border-radius: 0.75rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

/* Modal Header */
.modal-header {
    border-bottom: 1px solid #E4E6EF;
    padding: 1.5rem;
}

.modal-title {
    font-weight: 600;
    font-size: 1.25rem;
    color: #181C32;
}

/* Modal Body */
.modal-body {
    padding: 1.5rem;
}

/* Modal Footer */
.modal-footer {
    border-top: 1px solid #E4E6EF;
    padding: 1rem 1.5rem;
}

/* Modal Close Button */
.btn-close {
    opacity: 0.5;
    transition: opacity 0.2s ease;
}

.btn-close:hover {
    opacity: 1;
}

/* ==========================================
   ALERTS & NOTIFICATIONS
   ========================================== */

/* Alert Base - Better Spacing */
.alert {
    border: 0;
    border-radius: 0.475rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.alert-success {
    background-color: #F1FDF4;
    border-left-color: #50CD89;
    color: #1B5E20;
}

.alert-danger {
    background-color: #FFF5F8;
    border-left-color: #F1416C;
    color: #B71C1C;
}

.alert-warning {
    background-color: #FFF8E1;
    border-left-color: #FFC700;
    color: #E65100;
}

.alert-info {
    background-color: #F1FAFF;
    border-left-color: #3699FF;
    color: #0D47A1;
}

/* Alert Dismissible */
.alert-dismissible .btn-close {
    padding: 0.75rem 1.25rem;
}

/* ==========================================
   BREADCRUMBS
   ========================================== */

.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin: 0;
}

.breadcrumb-item {
    font-size: 0.875rem;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: '/';
    color: #A1A5B7;
    padding: 0 0.5rem;
}

.breadcrumb-item a {
    color: #7E8299;
    text-decoration: none;
    transition: color 0.2s ease;
}

.breadcrumb-item a:hover {
    color: #3699FF;
}

.breadcrumb-item.active {
    color: #181C32;
    font-weight: 600;
}

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

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(90deg, #F5F8FA 25%, #E4E6EF 50%, #F5F8FA 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 0.475rem;
}

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

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* Spinner */
.spinner-border {
    width: 1.5rem;
    height: 1.5rem;
    border-width: 0.2em;
}

/* ==========================================
   EMPTY STATES
   ========================================== */

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
}

.empty-state-icon {
    width: 120px;
    height: 120px;
    margin: 0 auto 1.5rem;
    opacity: 0.3;
    color: #A1A5B7;
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #181C32;
    margin-bottom: 0.5rem;
}

.empty-state-description {
    color: #7E8299;
    margin-bottom: 1.5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.empty-state-action {
    margin-top: 1.5rem;
}

/* ==========================================
   RESPONSIVE IMPROVEMENTS
   ========================================== */

@media (max-width: 991px) {
    .card {
        margin-bottom: 1.5rem;
    }

    .card-header,
    .card-body,
    .card-footer {
        padding: 1rem;
    }

    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-content {
        border-radius: 0.5rem;
    }
}

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

    .btn-group .btn {
        width: 100%;
        margin-bottom: 0.5rem;
        border-radius: 0.475rem !important;
    }

    .btn-group .btn:last-child {
        margin-bottom: 0;
    }
}

