/**
 * HostFinance - Estilos Principais
 * Tema: Azul claro + Branco + Cinza suave
 */

/* ==================== VARIÁVEIS ==================== */
:root {
    --primary-color: #0d6efd;
    --primary-light: #3d8bfa;
    --primary-dark: #0a58ca;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    
    --bg-color: #f5f7fa;
    --card-bg: #ffffff;
    --border-color: #dee2e6;
    
    --text-color: #333333;
    --text-muted: #6c757d;
    
    --navbar-height: 70px;
    --sidebar-width: 250px;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    
    --transition: all 0.3s ease;
}

/* ==================== RESET & BASE ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--bg-color);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
}

/* ==================== LAYOUT ==================== */
.navbar-fixed {
    padding-top: var(--navbar-height);
}

.main-content {
    min-height: calc(100vh - var(--navbar-height));
    padding: 30px 0;
}

/* ==================== NAVBAR ==================== */
.navbar {
    height: var(--navbar-height);
    background: var(--card-bg);
    box-shadow: var(--box-shadow);
    z-index: 1000;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color) !important;
    display: flex;
    align-items: center;
    gap: 10px;
}

.navbar-brand img {
    height: 35px;
}

.nav-link {
    color: var(--text-color) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--primary-color) !important;
}

.nav-dropdown {
    position: relative;
}

.dropdown-menu {
    border: none;
    box-shadow: var(--box-shadow);
    border-radius: var(--border-radius);
    margin-top: 10px;
}

.dropdown-item {
    padding: 10px 20px;
    border-radius: 5px;
    transition: var(--transition);
}

.dropdown-item:hover {
    background-color: var(--primary-color);
    color: white;
}

/* ==================== CARDS ==================== */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    background: var(--card-bg);
    transition: var(--transition);
}

.card:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.12);
}

.card-header {
    background: white;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    padding: 15px 20px;
}

.card-body {
    padding: 20px;
}

.card-footer {
    background: var(--light-color);
    border-top: 1px solid var(--border-color);
    padding: 15px 20px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 15px;
}

/* ==================== STATS CARDS ==================== */
.stat-card {
    padding: 20px;
    border-radius: var(--border-radius);
    text-align: center;
}

.stat-card .stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-size: 24px;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--dark-color);
}

.stat-card .stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ==================== TABLES ==================== */
.table {
    margin-bottom: 0;
}

.table thead th {
    background: var(--light-color);
    border-bottom: 2px solid var(--border-color);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 15px;
}

.table tbody td {
    padding: 15px;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* ==================== BADGES ==================== */
.badge {
    padding: 6px 12px;
    font-weight: 500;
    font-size: 0.8rem;
    border-radius: 20px;
}

.badge-primary { background-color: var(--primary-color); }
.badge-success { background-color: var(--success-color); }
.badge-warning { background-color: var(--warning-color); color: #000; }
.badge-danger { background-color: var(--danger-color); }
.badge-info { background-color: var(--info-color); color: #000; }
.badge-secondary { background-color: var(--secondary-color); }
.badge-dark { background-color: var(--dark-color); }

/* ==================== BUTTONS ==================== */
.btn {
    padding: 10px 20px;
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    color: white;
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-outline-primary {
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-sm {
    padding: 5px 15px;
    font-size: 0.85rem;
}

.btn-lg {
    padding: 15px 30px;
    font-size: 1.1rem;
}

/* ==================== FORMS ==================== */
.form-control {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 12px 15px;
    font-size: 14px;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}

.form-label {
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 8px;
}

.form-text {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.form-select {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 12px 15px;
}

/* ==================== MODALS ==================== */
.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 20px 25px;
}

.modal-title {
    font-weight: 600;
}

.modal-body {
    padding: 25px;
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 15px 25px;
}

/* ==================== ALERTS ==================== */
.alert {
    border: none;
    border-radius: var(--border-radius);
    padding: 15px 20px;
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.alert-danger {
    background-color: #f8d7da;
    color: #842029;
}

.alert-warning {
    background-color: #fff3cd;
    color: #664d03;
}

.alert-info {
    background-color: #cff4fc;
    color: #055160;
}

/* ==================== PAGINATION ==================== */
.pagination {
    margin: 0;
}

.page-link {
    color: var(--primary-color);
    border: 1px solid var(--border-color);
    padding: 8px 15px;
    transition: var(--transition);
}

.page-link:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.page-item.active .page-link {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

/* ==================== SIDEBAR (Admin only) ==================== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--card-bg);
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    z-index: 100;
    overflow-y: auto;
}

.sidebar-header {
    padding: 20px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-menu {
    padding: 20px 0;
}

.sidebar-menu-item {
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-color);
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-menu-item:hover {
    background: var(--light-color);
    color: var(--primary-color);
}

.sidebar-menu-item.active {
    background: rgba(13, 110, 253, 0.1);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
}

.content-wrapper {
    margin-left: var(--sidebar-width);
    padding-top: var(--navbar-height);
}

/* ==================== LOGIN/REGISTER ==================== */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
}

.auth-card {
    width: 100%;
    max-width: 450px;
    padding: 40px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.auth-logo {
    text-align: center;
    margin-bottom: 30px;
}

.auth-logo h1 {
    color: var(--primary-color);
    font-size: 2rem;
    font-weight: 700;
}

.auth-logo p {
    color: var(--text-muted);
    margin-top: 5px;
}

/* ==================== DASHBOARD ==================== */
.dashboard-welcome {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 30px;
    border-radius: var(--border-radius);
    margin-bottom: 30px;
}

.dashboard-welcome h2 {
    margin-bottom: 10px;
}

/* ==================== ORDER/PRODUCT CARDS ==================== */
.plan-card {
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 30px;
    text-align: center;
    transition: var(--transition);
    background: white;
    height: 100%;
}

.plan-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-5px);
}

.plan-card.featured {
    border-color: var(--primary-color);
    position: relative;
}

.plan-card.featured::before {
    content: 'Mais Popular';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary-color);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.plan-name {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 10px;
}

.plan-price {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 20px 0;
}

.plan-price span {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 400;
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 20px 0;
    text-align: left;
}

.plan-features li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
}

.plan-features li:last-child {
    border-bottom: none;
}

.plan-features i {
    color: var(--success-color);
    margin-right: 10px;
}

/* ==================== INVOICE ==================== */
.invoice-container {
    background: white;
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.invoice-table {
    width: 100%;
    margin-bottom: 30px;
}

.invoice-table th {
    background: var(--light-color);
    padding: 15px;
    text-align: left;
    font-weight: 600;
}

.invoice-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

/* ==================== TICKET ==================== */
.ticket-list {
    background: white;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.ticket-item {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.ticket-item:hover {
    background: var(--light-color);
}

.ticket-item:last-child {
    border-bottom: none;
}

.ticket-subject {
    font-weight: 600;
    margin-bottom: 5px;
}

.ticket-meta {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.ticket-messages {
    background: white;
    border-radius: var(--border-radius);
}

.ticket-message {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.ticket-message.admin {
    background: rgba(13, 110, 253, 0.05);
}

.ticket-message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
}

.ticket-message-content {
    line-height: 1.8;
}

/* ==================== PRICING TABLES ==================== */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 30px;
    margin: 40px 0;
}

/* ==================== FOOTER ==================== */
.footer {
    background: white;
    padding: 30px 0;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.footer-text {
    text-align: center;
    color: var(--text-muted);
}

/* ==================== UTILITIES ==================== */
.text-primary { color: var(--primary-color) !important; }
.text-success { color: var(--success-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-muted { color: var(--text-muted) !important; }

.bg-primary { background-color: var(--primary-color) !important; }
.bg-success { background-color: var(--success-color) !important; }
.bg-warning { background-color: var(--warning-color) !important; }
.bg-danger { background-color: var(--danger-color) !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; }

.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; }

.p-0 { padding: 0 !important; }
.p-1 { padding: 0.25rem !important; }
.p-2 { padding: 0.5rem !important; }
.p-3 { padding: 1rem !important; }
.p-4 { padding: 1.5rem !important; }
.p-5 { padding: 3rem !important; }

.rounded { border-radius: var(--border-radius) !important; }
.shadow-sm { box-shadow: var(--box-shadow) !important; }
.shadow { box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important; }
.shadow-lg { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important; }

.d-flex { display: flex !important; }
.align-items-center { align-items: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-center { justify-content: center !important; }
.gap-2 { gap: 0.5rem !important; }
.gap-3 { gap: 1rem !important; }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1200px) {
    .container {
        max-width: 95%;
    }
}

@media (max-width: 992px) {
    :root {
        --navbar-height: 60px;
    }
    
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .content-wrapper {
        margin-left: 0;
    }
    
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }
    
    .sidebar-overlay.show {
        display: block;
    }
}

@media (max-width: 768px) {
    :root {
        --navbar-height: 60px;
    }
    
    .main-content {
        padding: 20px 0;
    }
    
    .card-body {
        padding: 15px;
    }
    
    .stat-card .stat-value {
        font-size: 1.5rem;
    }
    
    .auth-card {
        padding: 30px 20px;
        margin: 20px;
    }
    
    .dashboard-welcome {
        padding: 20px;
    }
    
    .table-responsive {
        font-size: 0.85rem;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }
    
    .btn-group {
        flex-wrap: wrap;
    }
    
    .btn-group .btn {
        margin-bottom: 5px;
    }
}

@media (max-width: 576px) {
    .btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
    
    .plan-price {
        font-size: 2rem;
    }
    
    .form-control, .form-select {
        padding: 10px 12px;
    }
    
    .modal {
        padding: 10px;
    }
    
    .modal-dialog {
        margin: 10px;
    }
}

/* ==================== ANIMATIONS ==================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

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

.fade-in-up {
    animation: fadeIn 0.5s ease-out;
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

/* Hover Effects */
.hover-lift {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.hover-lift:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.hover-scale {
    transition: transform 0.2s ease;
}

.hover-scale:hover {
    transform: scale(1.02);
}

/* Button Hover Animations */
.btn {
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.btn:active::after {
    width: 200px;
    height: 200px;
}

/* Card Animations */
.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card.hover-effect:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner-md {
    width: 35px;
    height: 35px;
    border-width: 3px;
}

/* Button Loading State */
.btn.loading {
    pointer-events: none;
    opacity: 0.7;
}

.btn.loading .btn-text {
    visibility: hidden;
}

.btn.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 350px;
}

.toast {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 10px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.toast-success {
    background: #d1e7dd;
    color: #0f5132;
    border-left: 4px solid #198754;
}

.toast-error {
    background: #f8d7da;
    color: #842029;
    border-left: 4px solid #dc3545;
}

.toast-warning {
    background: #fff3cd;
    color: #664d03;
    border-left: 4px solid #ffc107;
}

.toast-info {
    background: #cff4fc;
    color: #055160;
    border-left: 4px solid #0dcaf0;
}

.toast-close {
    margin-left: auto;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

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

/* Form Validation */
.form-control.is-invalid {
    border-color: var(--danger-color);
    background-image: none;
}

.form-control.is-valid {
    border-color: var(--success-color);
    background-image: none;
}

.was-validated .form-control:invalid {
    border-color: var(--danger-color);
}

.was-validated .form-control:valid {
    border-color: var(--success-color);
}

/* Table Responsive */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-responsive table {
    min-width: 600px;
}

/* Mobile Menu Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 5px;
    color: var(--text-color);
}

@media (max-width: 992px) {
    .menu-toggle {
        display: block;
    }
}

/* Focus States */
.btn:focus, .form-control:focus, .form-select:focus {
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

.btn-outline-primary:focus, .btn-outline-success:focus, .btn-outline-danger:focus {
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

/* Card Body Scroll */
.card-body-scroll {
    max-height: 400px;
    overflow-y: auto;
}

/* Responsive Grid Utilities */
.col-12 { width: 100%; }
.col-6 { width: 50%; }
.col-4 { width: 33.333%; }
.col-3 { width: 25%; }

@media (max-width: 768px) {
    .col-6, .col-4, .col-3 {
        width: 100%;
    }
}

.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }
.stagger-5 { animation-delay: 0.5s; }
