/* Custom CSS for CalorieTracker Pro */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.font-inter {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Navigation Styles */
.nav-link {
    @apply px-3 py-2 rounded-md text-sm font-medium text-gray-700 hover:text-primary hover:bg-green-50 transition-colors;
}

.nav-link.active {
    @apply text-primary bg-green-50;
}

/* Profile Avatar Dropdown */
.profile-avatar {
    position: relative;
    display: inline-block;
}

.profile-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 50;
}

.profile-avatar:hover .profile-dropdown,
.profile-dropdown:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.profile-dropdown a {
    display: block;
    padding: 12px 16px;
    color: #374151;
    text-decoration: none;
    transition: background-color 0.2s;
}

.profile-dropdown a:hover {
    background-color: #f3f4f6;
}

.profile-dropdown a:first-child {
    border-radius: 8px 8px 0 0;
}

.profile-dropdown a:last-child {
    border-radius: 0 0 8px 8px;
    border-top: 1px solid #e5e7eb;
}

/* Card Animations */
.card-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Progress Bars */
.progress-bar {
    transition: width 0.8s ease-in-out;
}

/* Food Item Cards */
.food-item {
    @apply bg-gray-50 rounded-lg p-4 border-2 border-transparent hover:border-primary transition-colors cursor-pointer;
}

.food-item.selected {
    @apply border-primary bg-green-50;
}

.food-item img {
    @apply w-16 h-16 object-cover rounded-lg mr-4;
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Scanner Interface */
.scanner-viewfinder {
    position: relative;
    border: 2px solid #10B981;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.1);
}

.scanner-viewfinder::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 2px;
    background: #10B981;
    animation: scan 2s ease-in-out infinite;
}

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

/* Custom Input Styles */
.form-input {
    @apply w-full px-4 py-3 border-2 border-gray-300 rounded-lg focus:border-primary focus:outline-none transition-colors;
}

.form-input:focus {
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Button Styles */
.btn-primary {
    @apply bg-primary text-white px-6 py-3 rounded-lg font-semibold hover:bg-green-600 transition-colors flex items-center justify-center;
}

.btn-secondary {
    @apply bg-secondary text-white px-6 py-3 rounded-lg font-semibold hover:bg-blue-600 transition-colors flex items-center justify-center;
}

.btn-outline {
    @apply border-2 border-primary text-primary px-6 py-3 rounded-lg font-semibold hover:bg-green-50 transition-colors flex items-center justify-center;
}

/* Modal Animations */
.modal {
    animation: fadeIn 0.3s ease;
}

.modal > div {
    animation: slideUp 0.3s ease;
}

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

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

/* Food Recognition Results */
.food-recognition-item {
    @apply bg-white rounded-lg border-2 border-gray-200 p-4 hover:border-primary transition-colors;
}

.food-recognition-item.selected {
    @apply border-primary bg-green-50;
}

.confidence-bar {
    @apply bg-gray-200 rounded-full h-2;
}

.confidence-fill {
    @apply bg-gradient-to-r from-red-500 via-yellow-500 to-green-500 h-2 rounded-full transition-all duration-1000;
}

/* Nutrition Facts Panel */
.nutrition-panel {
    @apply bg-white rounded-lg border-2 border-gray-200 p-6;
}

.nutrition-item {
    @apply flex justify-between py-2 border-b border-gray-100;
}

.nutrition-item:last-child {
    @apply border-b-0;
}

/* Premium Badge */
.premium-badge {
    @apply absolute -top-3 -right-3 bg-gradient-to-r from-purple-500 to-pink-500 text-white px-3 py-1 rounded-full text-xs font-bold;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Calorie Counter Display */
.calorie-counter {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    @apply text-white rounded-xl p-6;
}

.calorie-ring {
    position: relative;
    width: 120px;
    height: 120px;
}

.calorie-ring svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.calorie-ring circle {
    fill: none;
    stroke-width: 8;
}

.calorie-ring .ring-background {
    stroke: rgba(255, 255, 255, 0.2);
}

.calorie-ring .ring-progress {
    stroke: #fff;
    stroke-linecap: round;
    stroke-dasharray: 377; /* 2 * π * 60 */
    stroke-dashoffset: 377;
    animation: ring-progress 2s ease-in-out;
}

@keyframes ring-progress {
    from {
        stroke-dashoffset: 377;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-link {
        @apply block w-full text-left px-4 py-2 text-base;
    }
    
    .mobile-menu {
        @apply absolute top-full left-0 right-0 bg-white shadow-lg rounded-b-lg;
    }
    
    .food-item {
        @apply flex flex-col text-center;
    }
    
    .food-item img {
        @apply mx-auto mb-2 w-20 h-20;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .dark-mode {
        @apply bg-gray-900 text-white;
    }
    
    .dark-mode .bg-white {
        @apply bg-gray-800;
    }
    
    .dark-mode .text-gray-900 {
        @apply text-white;
    }
    
    .dark-mode .text-gray-600 {
        @apply text-gray-300;
    }
    
    .dark-mode .border-gray-300 {
        @apply border-gray-600;
    }
}

/* Accessibility Improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.focus-visible:focus {
    outline: 2px solid #10B981;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-friendly {
        background: white !important;
        color: black !important;
    }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #10B981;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #059669;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

.bounce-in {
    animation: bounceIn 0.6s ease-out;
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

/* Utility Classes */
.glass-effect {
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.gradient-text {
    background: linear-gradient(135deg, #10B981, #059669);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.shadow-glow {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}