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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    font-size: 1.1em;
    opacity: 0.9;
}

.tabs {
    display: flex;
    background: #f5f5f5;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    color: #666;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    background: #e8e8e8;
    color: #333;
}

.tab-btn.active {
    background: white;
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
    padding: 30px;
    min-height: 500px;
}

.tab-content.active {
    display: block;
}

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

.section-header h2 {
    color: #333;
    font-size: 1.8em;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: #e0e0e0;
    color: #333;
}

.btn-secondary:hover {
    background: #d0d0d0;
}

.btn-danger {
    background: #e74c3c;
    color: white;
    padding: 5px 10px;
    font-size: 0.9em;
}

.btn-danger:hover {
    background: #c0392b;
}

.table-container {
    overflow-x: auto;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

thead {
    background: #f8f9fa;
}

th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
}

td {
    padding: 12px 15px;
    border-bottom: 1px solid #f0f0f0;
}

tbody tr:hover {
    background: #f8f9fa;
}

.filters {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.filter-select {
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1em;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s;
}

.filter-select:hover {
    border-color: #667eea;
}

.filter-select:focus {
    outline: none;
    border-color: #667eea;
}

.meals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.meal-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s;
}

.meal-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    transform: translateY(-2px);
}

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

.meal-card-title {
    font-size: 1.3em;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.meal-card-meta {
    font-size: 0.9em;
    color: #666;
    margin-bottom: 10px;
}

.meal-components {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.component-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e0e0e0;
}

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

.component-name {
    font-weight: 500;
    color: #333;
}

.component-details {
    font-size: 0.9em;
    color: #666;
}

.meal-totals {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px solid #e0e0e0;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.total-item {
    text-align: center;
}

.total-label {
    font-size: 0.85em;
    color: #666;
    display: block;
    margin-bottom: 5px;
}

.total-value {
    font-size: 1.2em;
    font-weight: 600;
    color: #667eea;
}

.planner-container {
    margin-top: 20px;
}

.days-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.day-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 20px;
}

.day-header {
    font-size: 1.3em;
    font-weight: 600;
    color: #667eea;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.meal-slot {
    margin-bottom: 15px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #667eea;
}

.meal-slot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.meal-slot-time {
    font-weight: 600;
    color: #333;
}

.meal-slot-name {
    font-size: 1.1em;
    color: #667eea;
    margin-bottom: 5px;
}

.meal-slot-user {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
}

.meal-slot-macros {
    font-size: 0.9em;
    color: #666;
}

.empty-slot {
    padding: 20px;
    text-align: center;
    color: #999;
    font-style: italic;
    border: 2px dashed #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.empty-slot:hover {
    border-color: #667eea;
    color: #667eea;
    background: #f8f9fa;
}

.search-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.search-input {
    flex: 1;
    min-width: 200px;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1em;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
}

.search-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 20px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    margin: 50px auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-large {
    max-width: 900px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 20px;
}

.close:hover {
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #333;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1em;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #667eea;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 25px;
}

.component-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
    align-items: end;
}

.component-row input,
.component-row select {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
}

.meal-summary {
    margin-top: 25px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
}

.meal-summary h3 {
    margin-bottom: 15px;
    color: #333;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.summary-item {
    text-align: center;
    padding: 10px;
    background: white;
    border-radius: 6px;
}

.summary-label {
    display: block;
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
}

.summary-value {
    display: block;
    font-size: 1.3em;
    font-weight: 600;
    color: #667eea;
}

.meal-details-section {
    margin-bottom: 25px;
}

.meal-details-section h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3em;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.meal-slot:hover {
    background: #f0f4ff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    transition: all 0.3s;
}

/* Backup & Restore Styles */
.backup-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.backup-card {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    transition: all 0.3s;
}

.backup-card:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1);
}

.backup-card h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.backup-card p {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.6;
}

.backup-stats {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-label {
    font-size: 0.85em;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.5em;
    font-weight: 600;
    color: #667eea;
}

.import-options {
    margin: 15px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.import-label {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.import-label:hover {
    background: #e8e8e8;
}

.import-label input[type="radio"] {
    margin-right: 10px;
    cursor: pointer;
}

.import-status {
    margin-top: 15px;
    padding: 12px;
    border-radius: 6px;
    display: none;
}

.import-status.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.import-status.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

.warning-card {
    border-color: #ffc107;
    background: #fffbf0;
}

.backup-info {
    margin-top: 15px;
}

.info-item {
    margin-bottom: 10px;
    padding: 10px;
    background: white;
    border-radius: 4px;
    border-left: 3px solid #667eea;
}

.backup-tips {
    list-style: none;
    padding: 0;
    margin: 0;
}

.backup-tips li {
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
    color: #666;
    line-height: 1.6;
}

.backup-tips li:last-child {
    border-bottom: none;
}

.backup-tips code {
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
    color: #667eea;
}

/* Tags Styles */
.tags-input-container {
    margin-top: 10px;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    min-height: 40px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 2px solid #e0e0e0;
}

.tag {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    background: #667eea;
    color: white;
    border-radius: 20px;
    font-size: 0.9em;
    font-weight: 500;
    gap: 8px;
}

.tag-remove {
    background: rgba(255, 255, 255, 0.3);
    border: none;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    cursor: pointer;
    font-size: 0.8em;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}

.tag-remove:hover {
    background: rgba(255, 255, 255, 0.5);
}

.tags-input-row {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.tag-input {
    flex: 1;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 1em;
}

.tag-input:focus {
    outline: none;
    border-color: #667eea;
}

.common-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.common-tags small {
    color: #666;
    margin-right: 5px;
}

.tag-suggestion {
    padding: 4px 10px;
    background: #e8e8e8;
    border: 1px solid #d0d0d0;
    border-radius: 12px;
    font-size: 0.85em;
    cursor: pointer;
    color: #333;
    transition: all 0.2s;
}

.tag-suggestion:hover {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.meal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
    margin-bottom: 10px;
}

.meal-tag {
    display: inline-block;
    padding: 4px 10px;
    background: #e8f0fe;
    color: #667eea;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 500;
    border: 1px solid #cbd5e0;
}

@media (max-width: 768px) {
    .tabs {
        flex-direction: column;
    }
    
    .meals-grid,
    .days-grid,
    .search-results {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    header h1 {
        font-size: 1.8em;
    }
}
