/* Container */
.container-wide {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Header Section - COMPACT */
.calc-header {
    text-align: center;
    margin-bottom: 15px;
    padding-top: 10px;
}

.calc-title {
    color: #003366;
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 5px 0;
}

.calc-desc {
    color: #666;
    font-size: 13px;
    margin: 0;
}

/* Layout Grid - OPTIMIZED FOR NO SCROLLING */
.nutrition-layout {
    display: grid;
    grid-template-columns: 320px 1fr 320px;
    gap: 15px;
    margin-top: 15px;
    align-items: start;
}

.left-panel,
.middle-panel,
.right-panel {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Fixed sidebar for search - COMPACT */
.left-panel {
    position: sticky;
    top: 10px;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
}

/* Fixed sidebar for summary - COMPACT */
.right-panel {
    position: sticky;
    top: 10px;
    max-height: calc(100vh - 20px);
    overflow-y: auto;
}

/* Middle panel scrolls naturally */
.middle-panel {
    min-height: 400px;
}

/* Cards - COMPACT */
.calc-card {
    background: #ffffff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
    transition: all 0.2s ease;
}

.calc-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}

.card-title {
    color: #003366;
    font-size: 14px;
    font-weight: 700;
    margin: 0 0 12px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.card-header .card-title {
    margin: 0;
}

/* Search Box - COMPACT */
.search-box {
    display: flex;
    gap: 8px;
    flex-direction: column;
}

.search-input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.2s;
    background: #fafafa;
}

.search-input:focus {
    outline: none;
    border-color: #003366;
    background: #ffffff;
    box-shadow: 0 0 0 2px rgba(0,51,102,0.1);
}

.calc-btn {
    padding: 10px 18px;
    background: #003366;
    color: #ffffff;
    border: none;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.2s;
    white-space: nowrap;
}

.calc-btn:hover {
    background: #002244;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,51,102,0.3);
}

.calc-btn:active {
    transform: translateY(0);
}

.calc-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.btn-clear {
    padding: 6px 12px;
    background: #d32f2f;
    color: #ffffff;
    border: none;
    font-weight: 600;
    cursor: pointer;
    border-radius: 5px;
    font-size: 12px;
    transition: all 0.2s;
}

.btn-clear:hover {
    background: #b71c1c;
    transform: translateY(-1px);
}

.btn-secondary {
    padding: 10px 18px;
    background: #28a745;
    color: #ffffff;
    border: none;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    font-size: 13px;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #218838;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(40,167,69,0.3);
}

/* Loading - COMPACT */
.loading {
    text-align: center;
    padding: 20px 15px;
    color: #003366;
}

.loading-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f0f4f8;
    border-top-color: #003366;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading p {
    margin: 0;
    font-weight: 600;
    font-size: 12px;
}

/* Search Results - COMPACT */
.search-results {
    max-height: 320px;
    overflow-y: auto;
    margin-top: 12px;
    padding-right: 4px;
}

.food-item {
    padding: 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.food-item:hover {
    background: #ffffff;
    border-color: #003366;
    transform: translateX(4px);
    box-shadow: 0 2px 8px rgba(0,51,102,0.1);
}

.food-name {
    font-weight: 600;
    color: #003366;
    margin-bottom: 4px;
    font-size: 12px;
    line-height: 1.3;
}

.food-category {
    font-size: 10px;
    color: #666;
    display: inline-block;
    background: #e8f4f8;
    padding: 2px 8px;
    border-radius: 10px;
}

/* Selected Foods - COMPACT */
.selected-food-item {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8f4f8 100%);
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 4px solid #003366;
    transition: all 0.2s;
}

.selected-food-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,51,102,0.15);
}

.selected-food-name {
    font-weight: 700;
    color: #003366;
    font-size: 13px;
    margin-bottom: 8px;
    line-height: 1.3;
}

.serving-controls {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.serving-label {
    font-size: 11px;
    color: #555;
    font-weight: 600;
}

.serving-input {
    width: 60px;
    padding: 6px 8px;
    border: 2px solid #ccc;
    border-radius: 5px;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
}

.serving-input:focus {
    outline: none;
    border-color: #003366;
    background: #ffffff;
}

.view-details-btn {
    background: #003366;
    color: #ffffff;
    border: none;
    padding: 6px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s;
}

.view-details-btn:hover {
    background: #002244;
    transform: translateY(-1px);
}

.remove-food-btn {
    background: #d32f2f;
    color: #ffffff;
    border: none;
    padding: 6px 10px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s;
}

.remove-food-btn:hover {
    background: #b71c1c;
    transform: translateY(-1px);
}

/* Summary Card - COMPACT */
.summary-card {
    background: linear-gradient(135deg, #003366 0%, #004d99 100%);
    color: white;
}

.summary-card .card-title {
    color: white;
}

/* Nutrition Grid - OPTIMIZED */
.nutrition-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.nutrition-item {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    padding: 10px;
    border-radius: 8px;
    text-align: center;
    border: 2px solid rgba(255,255,255,0.2);
    transition: all 0.2s;
}

.nutrition-item:hover {
    background: rgba(255,255,255,0.25);
    transform: translateY(-1px);
}

.nutrition-label {
    font-size: 10px;
    color: rgba(255,255,255,0.9);
    margin-bottom: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nutrition-value {
    font-size: 20px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1;
}

.nutrition-unit {
    font-size: 11px;
    color: rgba(255,255,255,0.8);
    margin-left: 3px;
    font-weight: 500;
}

/* Diet Planner - COMPACT */
.diet-planner {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.diet-planner .card-title {
    color: white;
}

.calorie-goal-input {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 10px;
}

.calorie-goal-input input {
    flex: 1;
    padding: 8px 10px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    background: rgba(255,255,255,0.2);
    color: white;
    font-size: 13px;
    font-weight: 600;
}

.calorie-goal-input input::placeholder {
    color: rgba(255,255,255,0.7);
}

.calorie-goal-input input:focus {
    outline: none;
    background: rgba(255,255,255,0.3);
    border-color: white;
}

.goal-status {
    background: rgba(255,255,255,0.2);
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 10px;
    text-align: center;
}

.goal-status h4 {
    margin: 0 0 6px 0;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.goal-progress {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 6px;
}

.goal-difference {
    font-size: 11px;
    opacity: 0.9;
}

.goal-difference.over {
    color: #ffeb3b;
}

.goal-difference.under {
    color: #90ee90;
}

.action-buttons {
    display: flex;
    gap: 8px;
    flex-direction: column;
}

.action-buttons button {
    width: 100%;
}

/* Details Card - COMPACT */
.details-card {
    background: #f5f7fa;
    border: 2px solid #003366;
    max-height: 450px;
    overflow-y: auto;
}

.details-card .card-title {
    font-size: 13px;
    position: sticky;
    top: 0;
    background: #f5f7fa;
    padding-bottom: 10px;
    z-index: 10;
}

/* Nutrition Table - COMPACT */
.nutrition-table {
    width: 100%;
    margin-top: 10px;
    border-collapse: separate;
    border-spacing: 0 4px;
}

.nutrition-table tr {
    background: white;
    transition: all 0.2s;
}

.nutrition-table tr:hover {
    transform: scale(1.01);
    box-shadow: 0 2px 6px rgba(0,51,102,0.1);
}

.nutrition-table td {
    padding: 8px 10px;
    font-size: 11px;
}

.nutrition-table td:first-child {
    font-weight: 600;
    color: #003366;
    border-radius: 5px 0 0 5px;
}

.nutrition-table td:last-child {
    text-align: right;
    color: #333;
    font-weight: 600;
    border-radius: 0 5px 5px 0;
}

/* Empty States - COMPACT */
.empty-state {
    text-align: center;
    padding: 20px 15px;
    color: #999;
}

.empty-state-icon {
    font-size: 30px;
    margin-bottom: 8px;
}

.empty-summary {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8f4f8 100%);
    border: 2px dashed #003366;
}

.empty-state-large {
    text-align: center;
    padding: 30px 15px;
}

.empty-icon {
    font-size: 50px;
    margin-bottom: 12px;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.empty-state-large h3 {
    color: #003366;
    font-size: 16px;
    margin-bottom: 6px;
}

.empty-state-large p {
    color: #666;
    font-size: 12px;
}

/* Modal - COMPACT */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    padding: 20px;
    border-radius: 10px;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #003366;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #d32f2f;
}

.share-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.share-btn {
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: #fafafa;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #003366;
}

.share-btn:hover {
    background: #003366;
    color: white;
    border-color: #003366;
    transform: translateY(-1px);
}

/* Scrollbar Styling - THIN */
.search-results::-webkit-scrollbar,
.left-panel::-webkit-scrollbar,
.right-panel::-webkit-scrollbar,
.details-card::-webkit-scrollbar {
    width: 6px;
}

.search-results::-webkit-scrollbar-track,
.left-panel::-webkit-scrollbar-track,
.right-panel::-webkit-scrollbar-track,
.details-card::-webkit-scrollbar-track {
    background: #f0f4f8;
    border-radius: 10px;
}

.search-results::-webkit-scrollbar-thumb,
.left-panel::-webkit-scrollbar-thumb,
.right-panel::-webkit-scrollbar-thumb,
.details-card::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #003366, #004d99);
    border-radius: 10px;
}

.search-results::-webkit-scrollbar-thumb:hover,
.left-panel::-webkit-scrollbar-thumb:hover,
.right-panel::-webkit-scrollbar-thumb:hover,
.details-card::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #002244, #003366);
}

/* Responsive Design */
@media (max-width: 1400px) {
    .nutrition-layout {
        grid-template-columns: 280px 1fr 280px;
    }
}

@media (max-width: 1200px) {
    .nutrition-layout {
        grid-template-columns: 260px 1fr 260px;
    }
    
    .nutrition-value {
        font-size: 18px;
    }
}

@media (max-width: 1024px) {
    .nutrition-layout {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .left-panel,
    .right-panel {
        position: relative;
        top: 0;
        max-height: none;
    }
    
    .middle-panel {
        order: 2;
    }
    
    .left-panel {
        order: 1;
    }
    
    .right-panel {
        order: 3;
    }
}

@media (max-width: 768px) {
    .container-wide {
        padding: 0 10px;
    }
    
    .calc-card {
        padding: 12px;
    }
    
    .calc-title {
        font-size: 18px;
    }
    
    .calc-desc {
        font-size: 12px;
    }
    
    .search-box {
        flex-direction: column;
    }
    
    .calc-btn {
        width: 100%;
    }
    
    .nutrition-grid {
        grid-template-columns: 1fr;
    }
    
    .serving-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .serving-input,
    .view-details-btn,
    .remove-food-btn {
        width: 100%;
    }
    
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .btn-clear {
        width: 100%;
    }
    
    .nutrition-value {
        font-size: 18px;
    }
    
    .share-options {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .calc-title {
        font-size: 16px;
    }
    
    .card-title {
        font-size: 13px;
    }
    
    .empty-icon {
        font-size: 40px;
    }
    
    .empty-state-large h3 {
        font-size: 14px;
    }
}

/* Print Styles */
@media print {
    .search-box,
    .view-details-btn,
    .remove-food-btn,
    .btn-clear,
    .action-buttons {
        display: none;
    }
    
    .nutrition-layout {
        grid-template-columns: 1fr;
    }
    
    .left-panel,
    .right-panel {
        position: relative;
        max-height: none;
    }
}