// Bootstrap
@import "bootstrap/scss/bootstrap";

// =====================================================
// MATERIO TEMPLATE STYLES
// =====================================================

// Layout Variables
$layout-menu-width: 16.25rem;
$layout-navbar-height: 4.5rem;
$footer-height: 3rem;

// Primary Colors
$primary: #696cff;
$secondary: #8392ab;
$success: #02c39a;
$info: #03c3ff;
$warning: #fcb02c;
$danger: #ff4b4b;

// Grays
$gray-100: #f7f9fc;
$gray-200: #ebeeef;
$gray-300: #d8dfe5;
$gray-400: #b6c0c9;
$gray-500: #8392ab;
$gray-600: #596c87;
$gray-700: #465673;
$gray-800: #3b3f5c;
$gray-900: #2e323f;

// Body
body {
    background-color: $gray-100;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

// Layout Wrapper
.layout-wrapper {
    min-height: 100vh;
}

.layout-container {
    min-height: 100vh;
}

// Layout Menu (Sidebar)
.layout-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: $layout-menu-width;
    height: 100vh;
    background: linear-gradient(180deg, #5a5fe0 0%, $primary 100%);
    z-index: 1001;
    transition: width 0.2s ease-in-out;
    overflow-y: auto;
    overflow-x: hidden;

    &::-webkit-scrollbar {
        width: 6px;
    }

    &::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 3px;
    }
}

// App Brand
.app-brand {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.app-brand-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    color: #fff;
}

.app-brand-logo {
    font-size: 1.75rem;
    color: #fff;
}

.app-brand-text {
    font-size: 1.25rem;
    font-weight: 700;
    margin-left: 0.5rem;
}

// Menu Inner
.menu-inner {
    margin: 0;
    padding: 0.5rem 0;
    list-style: none;
}

.menu-item {
    position: relative;

    &.active {
        > .menu-link {
            background-color: rgba(255, 255, 255, 0.15);
            color: #fff;

            &::before {
                content: '';
                position: absolute;
                left: 0;
                top: 0;
                bottom: 0;
                width: 3px;
                background: #fff;
                border-radius: 0 2px 2px 0;
            }
        }
    }
}

.menu-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: all 0.2s ease;

    &:hover {
        background-color: rgba(255, 255, 255, 0.1);
        color: #fff;
    }

    i {
        font-size: 1.25rem;
        margin-right: 0.75rem;
    }

    .badge {
        margin-left: auto;
    }
}

.menu-toggle::after {
    content: '\F282';
    font-family: 'bootstrap-icons';
    margin-left: auto;
    transition: transform 0.2s;
}

.menu-sub {
    list-style: none;
    padding: 0;
    margin: 0;
    display: none;
    background: rgba(0, 0, 0, 0.1);

    .menu-item.active > .menu-link {
        background-color: rgba(255, 255, 255, 0.15);
        color: #fff;
    }

    .menu-link {
        padding-left: 3.25rem;
        font-size: 0.875rem;
    }
}

.menu-item.open {
    > .menu-sub {
        display: block;
    }

    > .menu-toggle::after {
        transform: rotate(-180deg);
    }
}

.menu-header {
    padding: 1rem 1.25rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.5);
}

// Layout Page
.layout-page {
    margin-left: $layout-menu-width;
    min-height: 100vh;
    transition: margin-left 0.2s ease-in-out;
}

// Layout Navbar
.layout-navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    height: $layout-navbar-height;
    background: #fff !important;
    border-bottom: 1px solid $gray-200;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.navbar-detached {
    padding: 0.5rem 1.5rem;
}

// Content Wrapper
.content-wrapper {
    padding: 1.5rem;
    min-height: calc(100vh - #{$layout-navbar-height} - #{$footer-height});
}

// Content Footer
.content-footer {
    background: #fff;
    border-top: 1px solid $gray-200;
    padding: 1rem 1.5rem;
    font-size: 0.875rem;
    color: $gray-500;
}

// Card
.card {
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    background: #fff;
    border-bottom: 1px solid $gray-200;
    padding: 1rem 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;

    h5 {
        margin: 0;
        font-weight: 600;
    }

    .small {
        color: $gray-500;
    }
}

.card-body {
    padding: 1.25rem;
}

// Table
.table {
    margin-bottom: 0;

    thead th {
        background: $gray-100;
        border-bottom: 1px solid $gray-200;
        padding: 0.875rem 1rem;
        font-weight: 600;
        font-size: 0.75rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
        color: $gray-600;
    }

    tbody td {
        padding: 0.875rem 1rem;
        vertical-align: middle;
        border-bottom: 1px solid $gray-100;
    }

    tbody tr:hover {
        background-color: rgba($primary, 0.02);
    }
}

// Buttons
.btn {
    font-weight: 500;
    padding: 0.5rem 1.25rem;
    border-radius: 0.358rem;
    transition: all 0.2s ease;

    i {
        font-size: 1rem;
    }
}

.btn-primary {
    background-color: $primary;
    border-color: $primary;

    &:hover {
        background-color: darken($primary, 8%);
        border-color: darken($primary, 8%);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba($primary, 0.3);
    }
}

.btn-outline-primary {
    border-color: $primary;
    color: $primary;

    &:hover {
        background-color: $primary;
        border-color: $primary;
    }
}

// Badge
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    font-size: 0.75rem;
}

.badge-notifications {
    position: absolute;
    top: -3px;
    right: -3px;
    font-size: 0.65rem;
}

// Form Controls
.form-control,
.form-select {
    border-radius: 0.358rem;
    padding: 0.5rem 0.875rem;
    border-color: $gray-300;
    font-size: 0.875rem;

    &:focus {
        border-color: $primary;
        box-shadow: 0 0 0 0.2rem rgba($primary, 0.15);
    }
}

// Avatar
.avatar {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
}

.avatar-online::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 8px;
    height: 8px;
    background: $success;
    border: 2px solid #fff;
    border-radius: 50%;
}

// Dropdown
.dropdown-menu {
    border: 1px solid $gray-200;
    border-radius: 0.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: 0.35rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    color: $gray-800;
    transition: all 0.15s ease;

    &:hover {
        background-color: $gray-100;
        color: $primary;
    }

    i {
        margin-right: 0.5rem;
        color: $gray-500;
    }
}

// Stat Cards
.stat-card {
    border: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    border-radius: 0.5rem;
    transition: all 0.3s ease;

    &:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    }

    .stat-icon {
        width: 48px;
        height: 48px;
        border-radius: 0.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.5rem;

        &.primary { background: rgba($primary, 0.1); color: $primary; }
        &.success { background: rgba($success, 0.1); color: $success; }
        &.warning { background: rgba($warning, 0.1); color: $warning; }
        &.danger { background: rgba($danger, 0.1); color: $danger; }
        &.info { background: rgba($info, 0.1); color: $info; }
    }

    h3 {
        font-weight: 700;
        margin: 0;
        font-size: 1.75rem;
    }

    p {
        margin: 0;
        font-size: 0.875rem;
        color: $gray-500;
    }
}

// Action Buttons
.action-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 0.35rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;

    &.edit {
        background: rgba($primary, 0.1);
        color: $primary;

        &:hover {
            background: $primary;
            color: #fff;
        }
    }

    &.delete {
        background: rgba($danger, 0.1);
        color: $danger;

        &:hover {
            background: $danger;
            color: #fff;
        }
    }

    &.view {
        background: rgba($success, 0.1);
        color: $success;

        &:hover {
            background: $success;
            color: #fff;
        }
    }
}

// Toast
.toast {
    background: #fff;
    border: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    border-radius: 0.5rem;
}

.toast-body {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
}

// Alerts
.alert {
    border: none;
    border-radius: 0.5rem;
    padding: 1rem 1.25rem;
}

// Pagination
.pagination {
    margin: 0;
    gap: 0.25rem;

    .page-link {
        border-radius: 0.35rem;
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
        color: $gray-700;
        border-color: $gray-200;

        &:hover {
            background-color: $gray-100;
            border-color: $primary;
            color: $primary;
        }
    }

    .page-item.active .page-link {
        background-color: $primary;
        border-color: $primary;
    }
}

// Modal
.modal-content {
    border: none;
    border-radius: 0.75rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

.modal-header {
    border-bottom: 1px solid $gray-200;
    padding: 1.25rem 1.5rem;
}

.modal-footer {
    border-top: 1px solid $gray-200;
    padding: 1rem 1.5rem;
}

// Empty State
.empty-state {
    text-align: center;
    padding: 3rem 1rem;

    i {
        font-size: 3rem;
        color: $gray-400;
        margin-bottom: 1rem;
    }

    p {
        color: $gray-500;
        margin: 0;
    }
}

// Utilities
.text-nowrap {
    white-space: nowrap !important;
}

.cursor-pointer {
    cursor: pointer;
}
