/**
 * CSS Customizado para Sistema Imobiliário
 * Custom styles with Material Design principles
 */

:root {
    /* Material Design Colors */
    --md-primary: #1976d2;
    --md-primary-dark: #1565c0;
    --md-primary-light: #42a5f5;
    --md-secondary: #388e3c;
    --md-secondary-dark: #2e7d32;
    --md-secondary-light: #66bb6a;
    --md-accent: #ff5722;
    --md-warning: #ff9800;
    --md-error: #f44336;
    --md-success: #4caf50;
    --md-info: #2196f3;
    
    /* Neutral Colors */
    --md-grey-50: #fafafa;
    --md-grey-100: #f5f5f5;
    --md-grey-200: #eeeeee;
    --md-grey-300: #e0e0e0;
    --md-grey-400: #bdbdbd;
    --md-grey-500: #9e9e9e;
    --md-grey-600: #757575;
    --md-grey-700: #616161;
    --md-grey-800: #424242;
    --md-grey-900: #212121;
    
    /* Shadows */
    --md-shadow-1: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
    --md-shadow-2: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
    --md-shadow-3: 0 10px 20px rgba(0,0,0,0.19), 0 6px 6px rgba(0,0,0,0.23);
    --md-shadow-4: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
    --md-shadow-5: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22);
    
    /* Transitions */
    --md-transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --md-transition-fast: all 0.15s cubic-bezier(0.4, 0.0, 0.2, 1);
}

/* Global Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--md-grey-800);
    background-color: var(--md-grey-50);
}

/* Custom Bootstrap Overrides */
.btn {
    border-radius: 4px;
    font-weight: 500;
    text-transform: uppercase;
    transition: var(--md-transition);
    box-shadow: var(--md-shadow-1);
}

.btn:hover {
    box-shadow: var(--md-shadow-2);
    transform: translateY(-1px);
}

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

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

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

.btn-secondary:hover {
    background-color: var(--md-secondary-dark);
    border-color: var(--md-secondary-dark);
}

.btn-danger {
    background-color: var(--md-error);
    border-color: var(--md-error);
}

.btn-warning {
    background-color: var(--md-warning);
    border-color: var(--md-warning);
}

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

.btn-info {
    background-color: var(--md-info);
    border-color: var(--md-info);
}

/* Cards */
.card {
    border-radius: 8px;
    border: none;
    box-shadow: var(--md-shadow-1);
    transition: var(--md-transition);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--md-shadow-2);
    transform: translateY(-2px);
}

.card-header {
    background-color: var(--md-primary);
    color: white;
    border-bottom: none;
    padding: 1rem 1.25rem;
    font-weight: 500;
}

.card-footer {
    background-color: var(--md-grey-50);
    border-top: 1px solid var(--md-grey-200);
}

/* Form Controls */
.form-control, .form-select {
    border-radius: 4px;
    border: 2px solid var(--md-grey-300);
    transition: var(--md-transition);
    padding: 0.75rem;
}

.form-control:focus, .form-select:focus {
    border-color: var(--md-primary);
    box-shadow: 0 0 0 0.2rem rgba(25, 118, 210, 0.25);
}

.form-label {
    font-weight: 500;
    color: var(--md-grey-700);
    margin-bottom: 0.5rem;
}

/* Material Design Input Groups */
.md-input-group {
    position: relative;
    margin-bottom: 1.5rem;
}

.md-input {
    width: 100%;
    padding: 0.75rem 0.75rem 0.75rem 2.5rem;
    border: 2px solid var(--md-grey-300);
    border-radius: 4px;
    font-size: 1rem;
    transition: var(--md-transition);
    background-color: white;
}

.md-input:focus {
    border-color: var(--md-primary);
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(25, 118, 210, 0.25);
}

.md-input-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--md-grey-500);
    font-size: 1.1rem;
}

.md-input:focus + .md-input-icon {
    color: var(--md-primary);
}

/* Navigation */
.navbar {
    box-shadow: var(--md-shadow-2);
    background-color: var(--md-primary) !important;
}

.navbar-brand {
    font-weight: 500;
    color: white !important;
}

.nav-link {
    color: rgba(255, 255, 255, 0.8) !important;
    transition: var(--md-transition-fast);
}

.nav-link:hover {
    color: white !important;
}

/* Sidebar */
.sidebar {
    background-color: white;
    box-shadow: var(--md-shadow-1);
    min-height: calc(100vh - 56px);
    transition: var(--md-transition);
}

.sidebar-link {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--md-grey-700);
    text-decoration: none;
    transition: var(--md-transition-fast);
    border-radius: 4px;
    margin: 0.25rem 0.5rem;
}

.sidebar-link:hover {
    background-color: var(--md-grey-100);
    color: var(--md-primary);
    text-decoration: none;
}

.sidebar-link.active {
    background-color: var(--md-primary);
    color: white;
}

.sidebar-link i {
    width: 20px;
    margin-right: 0.75rem;
}

/* Tables */
.table {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--md-shadow-1);
}

.table th {
    background-color: var(--md-grey-100);
    border-bottom: 2px solid var(--md-grey-200);
    color: var(--md-grey-700);
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

.table td {
    border-bottom: 1px solid var(--md-grey-200);
    padding: 1rem 0.75rem;
}

.table-hover tbody tr:hover {
    background-color: var(--md-grey-50);
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 16px;
}

.badge-status-active {
    background-color: var(--md-success);
    color: white;
}

.badge-status-inactive {
    background-color: var(--md-grey-500);
    color: white;
}

.badge-status-pending {
    background-color: var(--md-warning);
    color: white;
}

.badge-status-overdue {
    background-color: var(--md-error);
    color: white;
}

/* Alerts */
.alert {
    border-radius: 8px;
    border: none;
    box-shadow: var(--md-shadow-1);
}

.alert-primary {
    background-color: rgba(25, 118, 210, 0.1);
    color: var(--md-primary-dark);
}

.alert-success {
    background-color: rgba(76, 175, 80, 0.1);
    color: var(--md-secondary-dark);
}

.alert-warning {
    background-color: rgba(255, 152, 0, 0.1);
    color: #e65100;
}

.alert-danger {
    background-color: rgba(244, 67, 54, 0.1);
    color: #c62828;
}

/* Loading States */
.loading {
    position: relative;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--md-grey-300);
    border-top: 4px solid var(--md-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Property Cards */
.property-card {
    border-radius: 12px;
    overflow: hidden;
    transition: var(--md-transition);
    cursor: pointer;
}

.property-card:hover {
    box-shadow: var(--md-shadow-3);
    transform: translateY(-4px);
}

.property-image {
    height: 200px;
    position: relative;
    overflow: hidden;
    border-radius: 8px 8px 0 0;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
}

.property-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.3s ease;
}

.property-image:hover img {
    transform: scale(1.05);
}

.property-price {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background-color: var(--md-primary);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-weight: 500;
    box-shadow: var(--md-shadow-2);
}

.property-features {
    display: flex;
    gap: 1rem;
    margin: 0.5rem 0;
}

.property-feature {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    color: var(--md-grey-600);
    font-size: 0.875rem;
}

/* Dashboard Stats */
.stat-card {
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--md-primary), var(--md-primary-light));
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--md-primary);
    margin: 0;
}

.stat-label {
    color: var(--md-grey-600);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.stat-change {
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

.stat-change.positive {
    color: var(--md-success);
}

.stat-change.negative {
    color: var(--md-error);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        z-index: 1000;
        width: 280px;
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .property-card {
        margin-bottom: 1rem;
    }
    
    .table-responsive {
        border-radius: 8px;
    }
    
    .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .btn-group {
        display: flex;
        flex-direction: column;
    }
    
    .btn-group .btn {
        border-radius: 4px;
    }
    
    .stat-card {
        margin-bottom: 1rem;
    }
}

@media (max-width: 576px) {
    .container-fluid {
        padding: 0.5rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
    
    .property-features {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .stat-number {
        font-size: 2rem;
    }
}

/* High DPI Displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .btn, .card, .form-control {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

/* Print Styles */
@media print {
    .navbar, .sidebar, .btn, .alert {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid var(--md-grey-300);
    }
    
    .table {
        box-shadow: none;
    }
}

/* Accessibility */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--md-primary);
    color: white;
    padding: 8px;
    text-decoration: none;
    transition: top 0.3s;
}

.skip-link:focus {
    top: 6px;
}

/* Focus States */
.btn:focus,
.form-control:focus,
.form-select:focus {
    box-shadow: 0 0 0 0.2rem rgba(25, 118, 210, 0.5);
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}