* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    direction: rtl;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #e0f4ff;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* LOGIN PAGE */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 400px;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo h1 {
    color: #0066cc;
    font-size: 32px;
    margin-bottom: 10px;
}

.login-form {
    width: 100%;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-primary {
    background-color: #0066cc;
    color: white;
}

.btn-primary:hover {
    background-color: #0052a3;
    box-shadow: 0 5px 15px rgba(0, 102, 204, 0.3);
}

.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 20px;
    border: 1px solid #f5c6cb;
}

.success-message {
    background-color: #d4edda;
    color: #155724;
    padding: 12px;
    border-radius: 5px;
    margin-bottom: 20px;
    border: 1px solid #c3e6cb;
}

/* DASHBOARD */
.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: linear-gradient(180deg, #0066cc 0%, #0052a3 100%);
    padding: 20px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    right: 0;
    top: 0;
}

.sidebar-header {
    color: white;
    text-align: center;
    padding-bottom: 20px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 20px;
}

.sidebar-header h2 {
    font-size: 26px;
    margin-bottom: 5px;
    font-weight: 700;
}

.sidebar-header p {
    font-size: 15px;
    opacity: 0.9;
    font-weight: 500;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 10px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: white;
    text-decoration: none;
    border-radius: 5px;
    transition: all 0.3s;
    font-size: 17px;
    font-weight: 500;
}

.sidebar-menu a:hover {
    background-color: rgba(255, 255, 255, 0.2);
    padding-right: 20px;
}

.sidebar-menu a.active {
    background-color: #ff6b6b;
}

.sidebar-menu i {
    margin-right: 15px;
    font-size: 20px;
}

.main-content {
    margin-right: 280px;
    flex: 1;
}

.topbar {
    background: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.topbar-left h1 {
    color: #333;
    font-size: 30px;
    font-weight: 700;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #0066cc;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.btn-logout {
    padding: 8px 15px;
    background-color: #ff6b6b;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-size: 14px;
}

.btn-logout:hover {
    background-color: #ff5252;
}

.content {
    padding: 30px;
}

.page-title {
    margin-bottom: 30px;
}

.page-title h1 {
    color: #333;
    font-size: 28px;
    margin-bottom: 5px;
}

.page-title p {
    color: #666;
    font-size: 14px;
}

/* CARDS */
.card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 15px;
}

.card-header h2 {
    color: #333;
    font-size: 20px;
}

.card-header .btn {
    padding: 8px 20px;
    font-size: 14px;
}

/* PROPERTIES GRID */
.properties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.property-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s;
}

.property-card:hover {
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(-5px);
}

.property-image {
    width: 100%;
    height: 200px;
    background-color: #e0e0e0;
    overflow: hidden;
}

.property-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.property-info {
    padding: 15px;
}

.property-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.property-location {
    color: #666;
    font-size: 13px;
    margin-bottom: 10px;
}

.property-details {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    font-size: 13px;
    color: #666;
}

.property-price {
    color: #0066cc;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 10px;
}

.property-status {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 10px;
}

.status-available {
    background-color: #d4edda;
    color: #155724;
}

.status-sold {
    background-color: #f8d7da;
    color: #721c24;
}

.status-rented {
    background-color: #d1ecf1;
    color: #0c5460;
}

.btn-secondary {
    background-color: #666;
    color: white;
    padding: 8px 15px;
    font-size: 13px;
    margin-right: 5px;
}

.btn-secondary:hover {
    background-color: #555;
}

.btn-danger {
    background-color: #ff6b6b;
}

.btn-danger:hover {
    background-color: #ff5252;
}

/* TABLES */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

table thead {
    background-color: #f9f9f9;
}

table th {
    padding: 12px;
    text-align: right;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #ddd;
}

table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    text-align: right;
}

table tr:hover {
    background-color: #f9f9f9;
}

/* FORM ELEMENTS */
.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 14px;
}

.form-control:focus {
    outline: none;
    border-color: #0066cc;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

/* STATS */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.stat-card .number {
    font-size: 32px;
    font-weight: 700;
    color: #0066cc;
    margin-bottom: 10px;
}

.stat-card .label {
    color: #666;
    font-size: 14px;
}

/* MOBILE MENU TOGGLE BUTTON */
.mobile-menu-toggle {
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 9999;
    background: #0066cc !important;
    color: white !important;
    border: none !important;
    width: 50px;
    height: 50px;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 102, 204, 0.4);
    transition: all 0.3s;
    display: none;
    align-items: center;
    justify-content: center;
    outline: none;
}

.mobile-menu-toggle:hover {
    background: #0052a3 !important;
    transform: scale(1.05);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
    background: #003d7a !important;
}

.mobile-menu-toggle i {
    pointer-events: none;
    font-size: 18px;
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .sidebar {
        width: 260px;
    }

    .main-content {
        margin-right: 260px;
    }

    .properties-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    /* Show mobile menu toggle */
    .mobile-menu-toggle {
        display: flex !important;
    }
    
    /* Hide sidebar by default on mobile */
    .sidebar {
        position: fixed !important;
        right: -300px !important;
        width: 280px !important;
        z-index: 8888 !important;
        transition: right 0.3s ease-in-out !important;
        height: 100vh !important;
        overflow-y: auto !important;
        top: 0 !important;
        background: linear-gradient(180deg, #0066cc 0%, #0052a3 100%) !important;
    }
    
    /* Show sidebar when active */
    .sidebar.active {
        right: 0 !important;
        box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3) !important;
    }
    
    /* Overlay when menu is open */
    body.menu-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 7777;
    }
    
    /* Adjust main content */
    .main-content {
        margin-right: 0;
        width: 100%;
    }
    
    /* Overlay when menu is open */
    body.menu-open::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
    }
    
    /* Topbar adjustments */
    .topbar {
        padding: 15px;
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .topbar-left h1 {
        font-size: 18px;
    }
    
    .topbar-right {
        width: 100%;
        justify-content: space-between;
    }
    
    .user-avatar {
        width: 35px;
        height: 35px;
        font-size: 14px;
    }
    
    .content {
        padding: 20px;
    }

    .properties-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }
    
    /* Sidebar scrollbar styling for mobile */
    .sidebar::-webkit-scrollbar {
        width: 6px;
    }
    
    .sidebar::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.1);
    }
    
    .sidebar::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.3);
        border-radius: 3px;
    }
    
    .sidebar::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.5);
    }
    
    .sidebar-menu a span {
        display: inline;
    }
}

/* RESPONSIVE DESIGN - TABLET BREAKPOINT */
@media (max-width: 768px) {
    /* Grid Layouts */
    .form-row, .form-row-2 {
        display: block !important;
        grid-template-columns: 1fr !important;
    }
    
    .form-row input, .form-row select, .form-row textarea {
        width: 100% !important;
        margin-bottom: 15px;
        box-sizing: border-box;
    }
    
    /* Dashboard Grid */
    .stats-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
    }
    
    .properties-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
    }
    
    /* Tables */
    table {
        font-size: 14px !important;
    }
    
    table th, table td {
        padding: 8px !important;
        font-size: 13px;
    }
    
    /* Cards */
    .card {
        padding: 15px !important;
    }
    
    .card-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    /* Buttons */
    .btn {
        font-size: 14px !important;
        padding: 10px 15px !important;
    }
    
    .action-buttons {
        flex-wrap: wrap;
        gap: 8px !important;
    }
    
    /* Forms */
    .form-panel {
        padding: 20px 15px !important;
    }
    
    /* Dashboard specific */
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 15px;
    }
    
    .dashboard-title {
        font-size: 1.8em !important;
    }
    
    .dashboard-bottom {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .dashboard-bottom input, .dashboard-bottom select {
        min-width: 140px;
    }
}

/* MOBILE FIRST BREAKPOINT */
@media (max-width: 480px) {
    .mobile-menu-toggle {
        width: 45px;
        height: 45px;
        top: 10px;
        right: 10px;
        font-size: 18px;
    }
    
    .sidebar {
        width: 260px;
    }
    
    .topbar {
        padding: 12px;
    }
    
    .topbar-left h1 {
        font-size: 16px;
    }
    
    .user-profile {
        font-size: 13px;
    }
    
    .user-avatar {
        width: 32px;
        height: 32px;
        font-size: 13px;
    }
    
    .content {
        padding: 15px;
    }
    
    .sidebar-menu a {
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .sidebar-menu i {
        margin-right: 12px;
        font-size: 16px;
    }
    
    .sidebar-header h2 {
        font-size: 18px;
    }
    
    .sidebar-header p {
        font-size: 11px;
    }
    
    /* Mobile specific adjustments */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }
    
    .properties-grid {
        grid-template-columns: 1fr !important;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr !important;
        gap: 12px;
    }
    
    .dashboard-title {
        font-size: 1.5em !important;
        margin: 15px 0 15px;
    }
    
    /* Tables - horizontal scroll */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table {
        min-width: 600px;
    }
    
    /* Forms */
    .form-row {
        margin-bottom: 10px;
    }
    
    .form-row input, .form-row select, .form-row textarea {
        padding: 12px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Action buttons */
    .action-buttons {
        flex-direction: column;
        align-items: stretch;
    }
    
    .btn {
        text-align: center;
        justify-content: center;
        margin-bottom: 8px;
    }
    
    /* Search bars */
    div[style*="display:flex"] {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    /* Dashboard bottom controls */
    .dashboard-bottom {
        flex-direction: column;
        align-items: stretch;
    }
    
    .dashboard-bottom input, .dashboard-bottom select, .dashboard-bottom button {
        width: 100%;
        margin-bottom: 8px;
    }
    
    /* Font sizes */
    .page-title h1 {
        font-size: 22px !important;
    }
    
    .card-header h2 {
        font-size: 18px !important;
    }
    
    /* Touch targets */
    .btn, button, input, select, textarea {
        min-height: 44px;
    }
    
    /* Margins and spacing */
    .card {
        margin-bottom: 15px;
    }
}

/* RESPONSIVE UTILITIES */
.mobile-only {
    display: none !important;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block !important;
    }
    
    .desktop-only {
        display: none !important;
    }
}

/* TABLE RESPONSIVE WRAPPER */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

@media (max-width: 768px) {
    .table-responsive {
        border: 1px solid #dee2e6;
        border-radius: 0.25rem;
    }
}
