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

/* PWA Fullscreen Support */
@media (display-mode: fullscreen) {
    body {
        padding-top: 0;
    }
    
    .header {
        padding-top: env(safe-area-inset-top, 25px);
    }
}

/* Hide browser chrome in standalone mode */
@media (display-mode: standalone) {
    body {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -khtml-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #FFFFFF;
    color: #212529;
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    /* Поддержка safe areas для fullscreen */
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: #FFFFFF;
    border-bottom: 1px solid #F8F9FA;
    padding: 25px 20px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content {
    flex: 1;
    text-align: center;
}

.app-title {
    font-size: 32px;
    font-weight: 800;
    color: #3B82F6;
    margin-bottom: 8px;
    text-shadow: none;
}

.app-subtitle {
    font-size: 16px;
    color: #6C757D;
    font-weight: 500;
}

/* Language Switcher */
.language-switcher {
    display: flex;
    gap: 4px;
    background: #F8F9FA;
    border-radius: 8px;
    padding: 4px;
}

.lang-btn {
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: #6C757D;
    font-size: 12px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 36px;
}

.lang-btn:hover {
    background: #E9ECEF;
    color: #212529;
}

.lang-btn.active {
    background: #3B82F6;
    color: #FFFFFF;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

/* Stats Container */
.stats-container {
    background: #F8F9FA;
    padding: 25px;
    margin: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    border: 1px solid #F8F9FA;
}

.stats-text {
    font-size: 18px;
    margin-bottom: 20px;
    font-weight: 500;
    color: #212529;
}

/* Buttons */
.btn {
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: #3B82F6;
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
}

.btn-primary:hover {
    background: #2563EB;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: #10B981;
    color: white;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.2);
}

.btn-secondary:hover {
    background: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.btn-back {
    background: #F8F9FA;
    color: #3B82F6;
    padding: 12px 20px;
    margin-bottom: 20px;
    border: 1px solid #F8F9FA;
}

.btn-back:hover {
    background: #FFFFFF;
    border-color: #3B82F6;
    transform: translateY(-1px);
}

/* Main Content */
main {
    flex: 1;
    position: relative;
}

.screen {
    display: none;
    padding: 20px;
    min-height: calc(100vh - 200px);
}

.screen.active {
    display: block;
}

.screen-header {
    margin-bottom: 30px;
}

.category-header {
    text-align: center;
    margin-top: 20px;
}

.category-icon {
    font-size: 50px;
    margin-bottom: 10px;
}

.category-title {
    font-size: 24px;
    font-weight: bold;
}

/* Categories Grid */
.categories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px;
    padding: 0 15px;
}

.category-card {
    background: #FFFFFF;
    padding: 30px 20px;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid #F8F9FA;
    position: relative;
    overflow: hidden;
}

.category-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #F8F9FA;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.category-card:hover::before {
    opacity: 1;
}

.category-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border-color: #3B82F6;
}

.category-card-icon {
    font-size: 48px;
    margin-bottom: 15px;
    display: block;
    position: relative;
    z-index: 1;
    transition: transform 0.2s ease;
}

.category-card:hover .category-card-icon {
    transform: scale(1.05);
}

.category-card-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
    color: #212529;
}

.category-card-count {
    font-size: 14px;
    color: #6C757D;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

/* Content Area */
.content {
    max-height: calc(100vh - 300px);
    overflow-y: auto;
    padding-right: 5px;
}

/* Card Styles */
.card-container {
    margin-bottom: 30px;
}

.section-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #212529;
}

.section-subtitle {
    font-size: 16px;
    color: #6C757D;
    margin-bottom: 25px;
    font-weight: 500;
}

.card {
    background: #FFFFFF;
    border-radius: 12px;
    padding: 30px;
    border-left: 4px solid #3B82F6;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid #F8F9FA;
    transition: all 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border-color: #3B82F6;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.bank-name {
    font-size: 20px;
    font-weight: bold;
    color: #212529;
}

.cashback {
    font-size: 24px;
    font-weight: bold;
    color: #10B981;
}

.card-name {
    font-size: 16px;
    color: #6C757D;
    margin-bottom: 12px;
}

.card-description {
    font-size: 14px;
    color: #6C757D;
    margin-bottom: 20px;
}

.get-card-btn {
    width: 100%;
    padding: 18px;
    background: #3B82F6;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.2);
    position: relative;
    overflow: hidden;
}

.get-card-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.get-card-btn:hover::before {
    left: 100%;
}

.get-card-btn:hover {
    background: #2563EB;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

/* Small Cards */
.small-card {
    background: #FFFFFF;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    border-left: 4px solid #3B82F6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    border: 1px solid #F8F9FA;
    transition: all 0.2s ease;
}

.small-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
    border-color: #3B82F6;
}

.small-card-info h4 {
    font-size: 16px;
    margin-bottom: 5px;
    color: #212529;
}

.small-card-info p {
    font-size: 14px;
    color: #6C757D;
}

.small-card-cashback {
    font-size: 18px;
    font-weight: bold;
    color: #10B981;
}

/* User Cards */
.cards-list {
    margin-top: 20px;
}

.user-card {
    background: #FFFFFF;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    border: 1px solid #F8F9FA;
    transition: all 0.2s ease;
}

.user-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.08);
}

.user-card-info h4 {
    font-size: 18px;
    margin-bottom: 5px;
    color: #212529;
}

.user-card-info p {
    font-size: 14px;
    color: #6C757D;
}

.delete-btn {
    background: #EF4444;
    color: white;
    border: none;
    border-radius: 6px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s ease;
}

.delete-btn:hover {
    background: #DC2626;
    transform: translateY(-1px);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 60px;
    margin-bottom: 20px;
}

.empty-state h3 {
    font-size: 20px;
    margin-bottom: 15px;
    color: #212529;
}

.empty-state p {
    color: #6C757D;
    max-width: 300px;
    margin: 0 auto;
    line-height: 1.6;
}

/* No User Cards */
.no-user-cards {
    background: #FFFFFF;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    border: 1px solid #F8F9FA;
}

.no-user-cards h3 {
    color: #EF4444;
    margin-bottom: 15px;
}

.no-user-cards p {
    color: #6C757D;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(33, 37, 41, 0.5);
    animation: fadeIn 0.2s ease;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: #FFFFFF;
    border-radius: 12px;
    padding: 30px;
    margin: 20px;
    width: 90%;
    max-width: 400px;
    animation: slideUp 0.2s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.modal-content h3 {
    text-align: center;
    margin-bottom: 25px;
    color: #212529;
}

.modal-content input,
.modal-content select {
    width: 100%;
    padding: 15px;
    border: 1px solid #F8F9FA;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 20px;
    transition: all 0.2s ease;
    color: #212529;
}

.modal-content input:focus,
.modal-content select:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.modal-content input::placeholder {
    color: #6C757D;
}

.modal-content select option {
    color: #212529;
    background: #FFFFFF;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    margin-top: 25px;
}

.modal-buttons .btn {
    flex: 1;
    text-align: center;
}

/* Loading */
.loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #FFFFFF;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.loading p {
    color: #6C757D;
    margin-top: 20px;
    font-weight: 500;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #F8F9FA;
    border-top: 4px solid #3B82F6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

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

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

/* Page transitions */
.screen {
    animation: fadeIn 0.3s ease;
}

.card {
    animation: slideUp 0.3s ease forwards;
}

/* Simple pulse for buttons */
.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-secondary:active {
    transform: translateY(0) scale(0.98);
}

/* Loading spinner */
.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #F8F9FA;
    border-top: 4px solid #3B82F6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .categories-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
        padding: 0 5px;
    }
    
    .category-card {
        padding: 20px 15px;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .modal-buttons {
        flex-direction: column;
    }
}

/* PWA Styles */
@media (display-mode: standalone) {
    .header {
        padding-top: 40px; /* Account for status bar */
    }
}

/* Referral Banner */
.referral-banner {
    margin: 30px 0 20px 0;
    background: linear-gradient(135deg, #FF6B35 0%, #FF8A50 100%);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.2);
}

.referral-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.referral-icon {
    flex-shrink: 0;
}

.bank-logo {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    background: #FFFFFF;
    padding: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    object-fit: contain;
}

.referral-text {
    flex: 1;
    color: #FFFFFF;
}

.referral-text h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
}

.referral-text p {
    margin: 5px 0;
    font-size: 14px;
    line-height: 1.4;
}

.promo-code {
    background: rgba(255, 255, 255, 0.15);
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 8px !important;
    backdrop-filter: blur(10px);
}

.referral-action {
    flex-shrink: 0;
}

.referral-btn {
    background: #FFFFFF;
    color: #FF6B35;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.referral-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Mobile responsive */
/* Mobile responsive */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 15px;
        padding: 20px 15px;
    }
    
    .app-title {
        font-size: 28px;
    }
    
    .app-subtitle {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .header {
        gap: 12px;
        padding: 15px 10px;
    }
    
    .app-title {
        font-size: 24px;
    }
    
    .language-switcher {
        align-self: center;
    }
    
    .referral-content {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }
    
    .referral-text h3 {
        font-size: 16px;
    }
    
    .referral-text p {
        font-size: 13px;
    }
    
    .referral-btn {
        width: 100%;
        padding: 14px 20px;
    }
}

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

.content::-webkit-scrollbar {
    width: 6px;
}

.content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.content::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.content::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}