/* Global Styles */
:root {
    --primary-color: #0d6efd;
    --dark-bg: #212529;
    --card-size-width: 85.6mm; /* Размер водительского удостоверения */
    --card-size-height: 54mm;
}

body {
    padding-top: 76px; /* Высота шапки */
    padding-bottom: 80px; /* Высота подвала */
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Header & Footer */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,.1);
}

footer {
    box-shadow: 0 -2px 4px rgba(0,0,0,.1);
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 156px);
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 80px 0;
    margin-bottom: 40px;
}

.hero-section img {
    max-height: 400px;
    object-fit: cover;
}

/* Info Tiles */
.info-tiles .card {
    transition: transform 0.3s;
    border: none;
}

.info-tiles .card:hover {
    transform: translateY(-5px);
}

.info-tiles .display-1 {
    font-size: 4rem;
}

/* Ad Cards - Driver License Size */
.ad-card {
    width: 100%;
    height: var(--card-size-height);
    max-width: var(--card-size-width);
    margin: 0 auto;
    perspective: 1000px;
    margin-bottom: 20px;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s;
    transform-style: preserve-3d;
}

.card-inner.flipped {
    transform: rotateY(180deg);
}

.card-front,
.card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
}

.card-back {
    transform: rotateY(180deg);
    background: #f8f9fa;
}

.card-img-wrapper {
    height: 60%;
    overflow: hidden;
}

.card-img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-body {
    padding: 8px;
    height: 30%;
    overflow: hidden;
}

.card-title {
    font-size: 0.9rem;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-text {
    font-size: 0.75rem;
    margin-bottom: 2px;
}

.card-actions {
    position: absolute;
    bottom: 5px;
    right: 5px;
    display: flex;
    gap: 5px;
}

.card-actions .btn-link {
    padding: 2px 5px;
    color: #666;
    text-decoration: none;
    font-size: 0.9rem;
}

.card-actions .btn-link:hover {
    color: var(--primary-color);
}

.card-details {
    font-size: 0.7rem;
}

/* Grid Layout */
#ads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(var(--card-size-width), 1fr));
    gap: 20px;
    justify-items: center;
}

@media (min-width: 1200px) {
    #ads-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 991px) {
    #ads-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 575px) {
    #ads-grid {
        grid-template-columns: 1fr;
    }
    
    .ad-card {
        max-width: 100%;
    }
}

/* Auth Pages */
.card {
    border: none;
    box-shadow: 0 2px 10px rgba(0,0,0,.1);
}

/* Profile */
.avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
}

/* Messages */
.message-bubble {
    padding: 10px 15px;
    border-radius: 18px;
    margin-bottom: 10px;
    max-width: 70%;
}

.message-sent {
    background: var(--primary-color);
    color: white;
    margin-left: auto;
}

.message-received {
    background: #e9ecef;
    color: #333;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
}

/* Share Modal */
.share-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,.3);
    z-index: 1050;
    display: none;
}

.share-modal.active {
    display: block;
}

.share-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,.5);
    z-index: 1040;
    display: none;
}

.share-overlay.active {
    display: block;
}

/* Favorite */
.favorite-btn.active i {
    color: #dc3545;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hero-section {
        padding: 40px 0;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    body {
        padding-top: 60px;
    }
}

/* Utility Classes */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.shadow-sm {
    box-shadow: 0 .125rem .25rem rgba(0,0,0,.075)!important;
}

