/* VK Mini App Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: #f7f8fa;
    color: #2c2d2e;
    line-height: 1.4;
}

/* Container */
.miniapp-container {
    max-width: 375px;
    margin: 0 auto;
    background: #ffffff;
    min-height: 100vh;
    position: relative;
}

.hidden {
    display: none;
}

/* Panel Header */
.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #e1e3e6;
    background: #ffffff;
    position: sticky;
    top: 0;
    z-index: 100;
}

.panel-header h1 {
    font-size: 18px;
    font-weight: 500;
    flex: 1;
    text-align: center;
}

.panel-header.success {
    background: #4bb34b;
    color: white;
    border-bottom-color: #4bb34b;
}

.panel-header.error {
    background: #d32f2f;
    color: white;
    border-bottom-color: #d32f2f;
}

.back-button, .add-button {
    background: none;
    border: none;
    font-size: 18px;
    color: #5181b8;
    cursor: pointer;
    padding: 4px;
    min-width: 32px;
    text-align: center;
}

.back-button:hover, .add-button:hover {
    opacity: 0.7;
}

/* Content Area */
.content {
    padding: 16px;
}

/* Groups */
.group {
    background: #ffffff;
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Profile Card */
.profile-card {
    display: flex;
    align-items: center;
    padding: 16px;
    background: #ffffff;
    border-radius: 8px;
}

.profile-card.active {
    background: linear-gradient(135deg, #5181b8 0%, #4bb34b 100%);
    color: white;
}

.profile-info {
    flex: 1;
}

.profile-name {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 4px;
}

.profile-diet {
    font-size: 13px;
    opacity: 0.8;
}

.profile-switch {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

/* Check Buttons */
.check-button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 16px;
    background: #ffffff;
    border: none;
    border-bottom: 1px solid #e1e3e6;
    cursor: pointer;
    text-align: left;
}

.check-button:last-child {
    border-bottom: none;
}

.check-button:hover {
    background: #f7f8fa;
}

.check-button.primary {
    background: linear-gradient(135deg, #5181b8 0%, #71aaeb 100%);
    color: white;
    border-radius: 8px;
    margin-bottom: 8px;
    border: none;
}

.button-icon {
    font-size: 24px;
    margin-right: 16px;
    min-width: 32px;
    text-align: center;
}

.button-text {
    flex: 1;
}

.button-title {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 2px;
}

.button-subtitle {
    font-size: 13px;
    opacity: 0.8;
}

/* Secondary Buttons */
.secondary-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px;
    background: #ffffff;
    border: none;
    border-bottom: 1px solid #e1e3e6;
    cursor: pointer;
    font-size: 15px;
}

.secondary-button:last-child {
    border-bottom: none;
}

.secondary-button:hover {
    background: #f7f8fa;
}

.chevron {
    color: #99a2ad;
    font-size: 16px;
}

/* Profile List */
.profile-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #e1e3e6;
}

.profile-item:last-child {
    border-bottom: none;
}

.profile-item.active {
    background: #f0f7ff;
}

.profile-details {
    font-size: 13px;
    color: #99a2ad;
    margin-top: 2px;
}

.active-indicator {
    color: #4bb34b;
    font-size: 16px;
    font-weight: bold;
}

.profile-limit {
    padding: 12px 16px;
    text-align: center;
    color: #99a2ad;
    font-size: 13px;
}

/* Camera/Scanner Areas */
.camera-area, .scanner-area {
    text-align: center;
    padding: 40px 20px;
}

.camera-placeholder, .scanner-frame {
    background: #f7f8fa;
    border: 2px dashed #d7d8d9;
    border-radius: 12px;
    padding: 60px 20px;
    margin-bottom: 20px;
}

.camera-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.scanner-frame {
    position: relative;
    background: linear-gradient(45deg, transparent 20%, #5181b8 21%, #5181b8 29%, transparent 30%),
                linear-gradient(-45deg, transparent 20%, #5181b8 21%, #5181b8 29%, transparent 30%),
                linear-gradient(45deg, transparent 70%, #5181b8 71%, #5181b8 79%, transparent 80%),
                linear-gradient(-45deg, transparent 70%, #5181b8 71%, #5181b8 79%, transparent 80%);
    background-size: 20px 20px;
    background-position: 0 0, 0 0, 0 0, 0 0;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.scanner-line {
    width: 80%;
    height: 2px;
    background: #e64646;
    animation: scan 2s linear infinite;
}

@keyframes scan {
    0%, 100% { transform: translateY(-50px); opacity: 0; }
    50% { transform: translateY(50px); opacity: 1; }
}

.instructions {
    margin-bottom: 20px;
    color: #99a2ad;
    text-align: center;
}

/* Action Buttons */
.photo-actions, .result-actions, .scanner-fallback {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.primary-button {
    background: #5181b8;
    color: white;
    border: none;
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
}

.primary-button:hover {
    background: #4c75a3;
}

.secondary-button {
    background: #f7f8fa;
    color: #5181b8;
    border: 1px solid #d7d8d9;
    padding: 14px 20px;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
}

/* Result Cards */
.result-card {
    display: flex;
    align-items: center;
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.result-card.success {
    background: linear-gradient(135deg, #4bb34b 0%, #5cb85c 100%);
    color: white;
}

.result-card.error {
    background: linear-gradient(135deg, #e64646 0%, #d9534f 100%);
    color: white;
}

.result-icon {
    font-size: 32px;
    margin-right: 16px;
    min-width: 48px;
    text-align: center;
}

.result-text h2 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 8px;
}

.result-text p {
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.5;
}

/* Search Bar */
.search-bar {
    margin-bottom: 16px;
}

.search-bar input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #d7d8d9;
    border-radius: 8px;
    font-size: 15px;
    background: #ffffff;
}

.search-bar input:focus {
    outline: none;
    border-color: #5181b8;
}

/* History Items */
.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #e1e3e6;
}

.history-item:last-child {
    border-bottom: none;
}

.history-product {
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 4px;
}

.history-date {
    font-size: 13px;
    color: #99a2ad;
}

.history-result {
    font-size: 13px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
}

.history-result.success {
    background: #e8f5e8;
    color: #4bb34b;
}

.history-result.error {
    background: #fdeaea;
    color: #e64646;
}

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

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 8px;
    color: #2c2d2e;
}

.empty-state p {
    font-size: 14px;
    color: #99a2ad;
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Loading State */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid #e1e3e6;
    border-top: 2px solid #5181b8;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #19191a;
        color: #e1e3e6;
    }
    
    .miniapp-container {
        background: #2a2a2b;
    }
    
    .panel-header, .group, .profile-card, .secondary-button {
        background: #2a2a2b;
        border-color: #363738;
    }
    
    .camera-placeholder, .scanner-frame {
        background: #363738;
        border-color: #4a4a4b;
    }
    
    .search-bar input {
        background: #363738;
        border-color: #4a4a4b;
        color: #e1e3e6;
    }
}

/* Responsive */
@media (max-width: 320px) {
    .content {
        padding: 12px;
    }
    
    .check-button {
        padding: 12px;
    }
    
    .button-title {
        font-size: 14px;
    }
    
    .button-subtitle {
        font-size: 12px;
    }
}
