:root {
    --primary-color: #4f46e5;
    --secondary-color: #818cf8;
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent-red: #ef4444;
    --accent-green: #10b981;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    display: flex;
    height: 100vh;
    overflow: hidden;
    background-image: 
        radial-gradient(at 0% 0%, rgba(79, 70, 229, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(129, 140, 248, 0.15) 0px, transparent 50%);
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    border-right: 1px solid var(--glass-border);
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    color: var(--primary-color);
}

nav ul {
    list-style: none;
}

nav li {
    padding: 1rem;
    margin-bottom: 0.5rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-dim);
}

nav li:hover, nav li.active {
    background: rgba(79, 70, 229, 0.1);
    color: var(--text-main);
}

nav li i {
    font-size: 1.25rem;
}

/* Content Area */
.content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 3rem;
}

section {
    display: none;
}

section.active {
    display: block;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-dim);
}

.user-info i {
    font-size: 1.5rem;
}

/* Dashboard Stats */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    width: 60px;
    height: 60px;
    background: rgba(79, 70, 229, 0.1);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.stat-details h3 {
    font-size: 0.875rem;
    color: var(--text-dim);
    margin-bottom: 0.25rem;
}

.stat-details p {
    font-size: 1.5rem;
    font-weight: 700;
}

/* Glass Table */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 2rem;
}

.recent-activity h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    color: var(--text-dim);
    font-weight: 500;
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

td {
    padding: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

/* Glass Buttons */
.glass-btn {
    background: rgba(79, 70, 229, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 0.75rem 1.5rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-secondary.glass-btn {
    background: rgba(255, 255, 255, 0.05);
}

.glass-btn:hover {
    background: rgba(79, 70, 229, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.3);
}

.btn-secondary.glass-btn:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.btn-primary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Login Screen */
.login-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    display: flex; justify-content: center; align-items: center;
    background: var(--bg-dark);
    z-index: 2000;
}

.login-card {
    width: 100%;
    max-width: 400px;
    padding: 3rem;
}

.login-card h2 {
    text-align: center;
    margin-bottom: 2rem;
}

.btn-logout {
    background: transparent;
    border: none;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1.25rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar { width: 80px; padding: 1.5rem 0.5rem; }
    .sidebar span, .logo span { display: none; }
    .content { padding: 2rem 1.5rem; }
}

@media (max-width: 768px) {
    body { flex-direction: column; }
    .sidebar { 
        width: 100%; 
        height: 60px; 
        position: fixed;
        bottom: 0;
        left: 0;
        border-right: none; 
        border-top: 1px solid var(--glass-border); 
        flex-direction: row; 
        justify-content: space-around; 
        padding: 0;
        z-index: 1500;
        background: rgba(15, 23, 42, 0.95);
    }
    .sidebar .logo { display: none; }
    .sidebar nav { width: 100%; height: 100%; }
    .sidebar nav ul { 
        display: flex; 
        width: 100%; 
        height: 100%;
        justify-content: space-around; 
        align-items: center;
    }
    .sidebar nav li { 
        padding: 0; 
        margin: 0; 
        flex-direction: column;
        gap: 0.25rem;
        font-size: 0.7rem;
        width: 60px;
        height: 100%;
        justify-content: center;
    }
    .sidebar nav li i { font-size: 1.2rem; }
    .sidebar nav li span { display: none; } /* Extra fallback */
    
    .content { 
        padding: 1.5rem 1rem 80px 1rem; 
        height: 100vh;
        overflow-y: auto;
    }
    header {
        margin-bottom: 2rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    .stats-container { display: flex; flex-direction: column; gap: 1rem; }
    .glass { padding: 1rem; overflow-x: auto; width: 100%; }
    
    /* Make tables scrollable */
    table { min-width: 600px; }
    
    .section-actions {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
        margin-bottom: 1.5rem;
    }
    .btn-logout { margin-top: 0.5rem; }
}

/* Modals */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 2rem;
}

/* Custom scrollbar */
.modal-content::-webkit-scrollbar {
    width: 6px;
}
.modal-content::-webkit-scrollbar-track {
    background: transparent;
}
.modal-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

.form-group {
    margin-bottom: 1rem;
}

form h3 {
    margin: 1.5rem 0 1rem 0;
    font-size: 1.1rem;
    color: var(--primary-color);
    border-bottom: 1px solid var(--glass-border);
    padding-bottom: 0.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-dim);
    font-size: 0.875rem;
}

.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    padding: 0.75rem;
    color: white;
    outline: none;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-top: 2rem;
}

.btn-secondary {
    background: transparent;
    color: var(--text-dim);
    border: 1px solid var(--glass-border);
    padding: 0.75rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
}

@media (max-width: 600px) {
    .form-row {
        grid-template-columns: 1fr;
    }
    .modal-content {
        padding: 1.5rem;
    }
}

/* New Styles for Improvements */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

.btn-edit {
    background: rgba(245, 158, 11, 0.2) !important;
    color: #f59e0b !important;
    border-color: rgba(245, 158, 11, 0.3) !important;
}

.btn-edit:hover {
    background: rgba(245, 158, 11, 0.4) !important;
}

.btn-delete {
    background: rgba(239, 68, 68, 0.2) !important;
    color: #ef4444 !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.4) !important;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.1);
}

.badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.bold {
    font-weight: 600;
}

.text-dim {
    color: var(--text-dim);
}

#properties-table th:last-child, 
#units-table th:last-child {
    text-align: right;
}

#properties-table td:last-child, 
#units-table td:last-child,
#clients-table td:last-child {
    display: flex;
    justify-content: flex-end;
}

/* Detail View Styles */
.detail-view, .detail-header {
    margin: 20px 0;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.detail-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.detail-item strong {
    display: block;
    font-size: 0.75rem;
    color: var(--text-dim);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 15px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-table th, .detail-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.detail-table th {
    background: rgba(255, 255, 255, 0.07);
    color: var(--text-dim);
    font-size: 0.85rem;
}

.dashboard-filter {
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.filter-group label {
    font-weight: 600;
    color: var(--text-color);
}

.filter-group select, .filter-group input {
    padding: 0.6rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: white;
    outline: none;
    transition: all 0.3s ease;
}

.filter-group select:focus, .filter-group input:focus {
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.15);
}

.filter-group select option {
    background: #1e1e1e;
    color: white;
}

.filter-group input {
    width: 100px;
}

.action-buttons {
    display: flex;
    gap: 0.8rem;
}

.text-center {
    text-align: center !important;
}

.section-actions {
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
