/* Modern CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Image quality improvements - removed to preserve original image quality */

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
    --text-color: #2c3e50;
    --text-light: #7f8c8d;
    --white: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--white);
    overflow-x: hidden;
}

/* Bootstrap helpers / compatibility */
.display-7 {
    font-size: clamp(1.25rem, 3.5vw, 1.75rem);
    font-weight: 700;
    line-height: 1.1;
}

.navbar-brand {
    min-width: 0;
}

.navbar-brand-text {
    display: inline-block;
    min-width: 0;
    max-width: 72vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 576px) {
    .navbar-brand-text {
        max-width: 60vw;
    }
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-light);
    margin-bottom: 2rem;
    line-height: 1.5;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.section-subtitle {
    font-size: 1.125rem;
    color: var(--text-light);
    margin-bottom: 0;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #5d6d7e 0%, #85929e 100%);
    color: var(--white);
    padding: 2.5rem 0;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 70%, rgba(52, 152, 219, 0.2) 0%, transparent 50%),
                radial-gradient(circle at 70% 30%, rgba(46, 204, 113, 0.2) 0%, transparent 50%);
    z-index: 1;
}

.hero-content {
    position: relative;
    z-index: 2;
}

.hero-logo {
    max-height: 80px;
    width: auto;
    filter: brightness(0) invert(1);
    transition: var(--transition);
    margin-bottom: 0.75rem;
}

.hero-logo:hover {
    transform: scale(1.05);
    filter: none;
}

.hero-title {
    font-size: 2rem;
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: var(--white);
}

.hero-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 1.5rem;
    line-height: 1.5;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.hero-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* Properties Section */
.properties-section {
    padding: 6rem 0;
    background-color: #f8f9fa;
}

.properties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

.property-card {
    background: var(--white);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
}

.property-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-lg);
}

.property-image {
    position: relative;
    overflow: hidden;
}

.property-image img {
    width: 100%;
    height: auto;
    display: block;
    transition: var(--transition);
}

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

.property-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    display: flex;
    align-items: flex-end;
    padding: 2rem;
    opacity: 0;
    transition: var(--transition);
}

.property-card:hover .property-overlay {
    opacity: 1;
}

.property-info {
    color: var(--white);
}

.property-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--white);
}

.property-description {
    font-size: 1rem;
    margin-bottom: 1.5rem;
    color: rgba(255, 255, 255, 0.9);
}

/* Services Section */
.services-section {
    padding: 6rem 0;
    background: var(--white);
}

.service-card {
    background: var(--white);
    padding: 2.5rem 2rem;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    height: 100%;
    border: 1px solid #f1f3f4;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--secondary-color);
}

.service-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--secondary-color), #5dade2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    transition: var(--transition);
}

.service-card:hover .service-icon {
    transform: scale(1.1);
}

.service-icon i {
    font-size: 2rem;
    color: var(--white);
}

.service-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.service-description {
    color: var(--text-light);
    line-height: 1.6;
    margin: 0;
}

/* Dashboard Section */
.dashboard-section {
    padding: 6rem 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.dashboard-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.dashboard-header {
    background: linear-gradient(135deg, var(--primary-color), #34495e);
    color: var(--white);
    padding: 2rem;
    text-align: center;
}

.dashboard-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--white);
}

.dashboard-subtitle {
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

.dashboard-content {
    padding: 2.5rem;
}

.dashboard-description {
    font-size: 1.125rem;
    color: var(--text-light);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.dashboard-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    border: 2px solid transparent;
}

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

.action-btn.primary:hover {
    background: #2980b9;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

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

.action-btn.secondary:hover {
    background: var(--secondary-color);
    color: var(--white);
    transform: translateY(-2px);
}

/* Login Section */
.login-section {
    padding: 6rem 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.login-header {
    background: linear-gradient(135deg, var(--primary-color), #34495e);
    color: var(--white);
    padding: 2rem;
    text-align: center;
}

.login-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--white);
}

.login-subtitle {
    color: rgba(255, 255, 255, 0.8);
    margin: 0;
}

.login-content {
    padding: 2.5rem;
}

.login-description {
    font-size: 1.125rem;
    color: var(--text-light);
    margin-bottom: 2rem;
    line-height: 1.6;
    text-align: center;
}

.login-actions {
    text-align: center;
}

/* Section Headers */
.section-header {
    margin-bottom: 4rem;
}

/* Cards */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

@media (hover: hover) and (pointer: fine) {
    .card:hover {
        box-shadow: var(--shadow-lg);
    }
}

.card-body {
    padding: 2rem;
}

/* Buttons */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition);
}

@media (hover: hover) and (pointer: fine) {
    .btn:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow);
    }
}

.btn-primary {
    background: linear-gradient(135deg, var(--secondary-color), #5dade2);
    border: none;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #2980b9, var(--secondary-color));
}

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

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

/* Responsive Design */
@media (max-width: 768px) {
    .hero-section {
        padding: 2rem 0;
    }
    
    .hero-logo {
        max-height: 60px;
        margin-bottom: 0.5rem;
    }
    
    .hero-title {
        font-size: 1.75rem;
        margin-bottom: 0.75rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.25rem;
    }
    
    .hero-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    /* Do not override Bootstrap button sizing globally on mobile */
    
    .section-title {
        font-size: 2rem;
    }
    
    .properties-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .dashboard-actions {
        flex-direction: column;
        align-items: center;
    }
    
    .action-btn {
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .hero-section {
        padding: 1.5rem 0;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .properties-section,
    .services-section,
    .dashboard-section,
    .login-section {
        padding: 4rem 0;
    }
    
    .service-card {
        padding: 2rem 1.5rem;
    }
    
    .dashboard-content,
    .login-content {
        padding: 2rem 1.5rem;
    }
}

/* Dark theme support */
.dark-theme {
    --text-color: #f8f9fa;
    --text-light: #adb5bd;
    --white: #1e1e1e;
    --light-color: #2c2c2c;
}

.dark-theme .card {
    background-color: var(--light-color);
    color: var(--text-color);
}

.dark-theme .service-card {
    background-color: var(--light-color);
    border-color: #444;
}

/* Animation utilities */
.fade-in {
    animation: fadeIn 0.6s ease-in;
}

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

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Focus states for accessibility */
.btn:focus,
.action-btn:focus {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

/* Loading states */
.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Utility classes */
.text-gradient {
    background: linear-gradient(135deg, var(--secondary-color), #5dade2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-custom {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.border-gradient {
    border: 2px solid;
    border-image: linear-gradient(135deg, var(--secondary-color), #5dade2) 1;
}

/* Mobile polish pass (phones ~390px) */
@media (max-width: 576px) {
    main.container {
        padding-top: 1rem !important;
        padding-bottom: 1.25rem !important;
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .card {
        box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    }

    .card.mb-4 {
        margin-bottom: 1rem !important;
    }

    h1 {
        font-size: 1.6rem;
        line-height: 1.15;
        margin-bottom: 0.75rem;
    }

    h2 {
        font-size: 1.35rem;
        line-height: 1.2;
        margin-bottom: 0.75rem;
    }

    .card-body {
        padding: 1.25rem;
    }

    .card-header {
        padding: 0.9rem 1.25rem;
    }

    .btn-lg {
        padding: 0.65rem 1rem;
        font-size: 1rem;
        border-radius: 12px;
    }

    .alert {
        padding: 0.85rem 1rem;
    }

    .stats-table {
        font-size: 0.8rem;
        table-layout: fixed;
        width: 100%;
    }

    .stats-table th,
    .stats-table td {
        padding: 0.4rem 0.5rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .stats-table th {
        font-size: 0.7rem;
        font-weight: 700;
        letter-spacing: 0.01em;
    }

    .stats-table td:nth-child(1),
    .stats-table th:nth-child(1) {
        text-align: center;
    }

    .stats-table td:nth-child(3),
    .stats-table td:nth-child(4),
    .stats-table td:nth-child(5) {
        text-align: right;
    }

    .stats-table td:nth-child(6),
    .stats-table th:nth-child(6) {
        text-align: center;
    }

    .stats-edit-btn {
        padding: 0.25rem 0.5rem;
        line-height: 1;
        min-height: 36px;
    }

    /* Таблицы на мобильных: горизонтальная прокрутка с видимым скроллбаром */
    .table-responsive {
        -webkit-overflow-scrolling: touch;
        overflow-x: auto;
        overflow-y: hidden;
        scrollbar-width: thin;
        scrollbar-color: rgba(0, 0, 0, 0.4) rgba(0, 0, 0, 0.1);
        margin-left: -1rem;
        margin-right: -1rem;
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .table-responsive::-webkit-scrollbar {
        height: 10px;
    }
    
    .table-responsive::-webkit-scrollbar-track {
        background: rgba(0, 0, 0, 0.1);
        border-radius: 5px;
    }
    
    .table-responsive::-webkit-scrollbar-thumb {
        background: rgba(0, 0, 0, 0.4);
        border-radius: 5px;
    }
    
    .table-responsive::-webkit-scrollbar-thumb:hover {
        background: rgba(0, 0, 0, 0.6);
    }
    
    .table-responsive table {
        min-width: 600px; /* Минимальная ширина для удобного просмотра */
        font-size: 0.85rem;
    }
    
    .table-responsive table th,
    .table-responsive table td {
        padding: 0.5rem 0.4rem;
        white-space: nowrap;
    }
    
    .table-responsive table th {
        font-size: 0.8rem;
        font-weight: 600;
    }

    .nav-tabs .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.95rem;
    }

    ol,
    ul {
        padding-left: 1.25rem;
    }

    .import-instructions-list {
        padding-left: 1.15rem;
    }

    .import-instructions-list ul {
        padding-left: 1.1rem;
    }
}

@media (pointer: coarse) {
    .btn {
        min-height: 44px;
    }

    .btn.btn-sm {
        min-height: 40px;
    }
}

/* Стили для интерактивности карточек на странице "О программе" */
.list-group-item.card-hover {
    background-color: #f8f9fa;
    transition: background-color 0.2s ease;
}