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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

h1 {
    text-align: center;
    color: white;
    margin-bottom: 30px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.8em;
}

.recipe-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 15px;
}

.settings-panel .recipe-form input {
    font-size: 14px;
    padding: 10px;
    width: 100%;
}

.protein-selector {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.protein-btn {
    flex: 1;
    min-width: 70px;
    padding: 8px 10px;
    font-size: 12px;
    background: #f8f9fa;
    color: #6c757d;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.protein-btn:hover {
    background: #e9ecef;
    border-color: #dee2e6;
    transform: none;
}

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

.add-recipe-btn {
    padding: 10px 20px;
    font-size: 14px;
    width: 100%;
}

.search-filter-row {
    display: flex;
    gap: 8px;
    margin-bottom: 15px;
}

.search-box {
    flex: 1;
}

.search-box input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

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

.protein-filter {
    flex-shrink: 0;
}

.protein-filter select {
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
}

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

input[type="text"] {
    flex: 1;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
    min-height: 44px; /* Better touch target for mobile */
}

input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
}

button {
    padding: 12px 24px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
    font-weight: 600;
    min-height: 44px; /* Better touch target for mobile */
}

button:hover {
    background: #5568d3;
    transform: translateY(-2px);
}

button:active {
    transform: translateY(0);
}

.generate-btn {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin-top: 10px;
}

.generate-btn:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8b 100%);
}

.recipe-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.recipe-item {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    transition: background 0.2s;
    border-left: 3px solid transparent;
}

.recipe-item:hover {
    background: #e9ecef;
    border-left-color: #667eea;
}

.recipe-name {
    font-weight: 500;
    color: #333;
    font-size: 0.95em;
    flex: 1;
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.recipe-text {
    word-break: break-word;
    line-height: 1.4;
}

.delete-btn {
    padding: 4px 8px;
    background: transparent;
    color: #dc3545;
    border: 1px solid #dc3545;
    font-size: 12px;
    margin-left: 4px;
}

.delete-btn:hover {
    background: #dc3545;
    color: white;
    transform: none;
}

.weekly-plan {
    display: grid;
    gap: 15px;
}

.day-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
    border-radius: 10px;
    border-left: 5px solid #667eea;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: move;
}

.day-card:hover {
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.day-card.dragging {
    opacity: 0.5;
    transform: scale(0.95);
}

.day-card.drag-over {
    border-left: 5px solid #28a745;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    transform: scale(1.02);
}

.day-name {
    font-weight: 700;
    color: #667eea;
    font-size: 1.2em;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.day-name-text {
    pointer-events: none;
}

.day-buttons {
    display: flex;
    gap: 5px;
}

.meal-name {
    color: #333;
    font-size: 1.1em;
    pointer-events: none;
}

.drag-hint {
    text-align: center;
    color: #6c757d;
    font-size: 0.9em;
    margin-top: 15px;
    font-style: italic;
}

.day-selector {
    margin-bottom: 20px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.day-selector h3 {
    color: #667eea;
    font-size: 1.1em;
    margin-bottom: 15px;
}

.day-checkboxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.day-checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    min-height: 44px; /* Better touch target for mobile */
}

.day-checkbox-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.day-checkbox-item label {
    cursor: pointer;
    font-size: 0.95em;
    color: #333;
    flex: 1;
}

.quick-select {
    margin-top: 10px;
    display: flex;
    gap: 10px;
}

.quick-select-btn {
    padding: 6px 12px;
    font-size: 14px;
    background: #6c757d;
}

.quick-select-btn:hover {
    background: #5a6268;
}

.clear-day-btn {
    padding: 4px 10px;
    background: #ffc107;
    font-size: 13px;
    margin-left: 10px;
}

.clear-day-btn:hover {
    background: #e0a800;
}

.edit-day-btn {
    padding: 4px 10px;
    background: #17a2b8;
    font-size: 13px;
    margin-left: 10px;
}

.edit-day-btn:hover {
    background: #138496;
}

.day-card.empty-day {
    background: linear-gradient(135deg, #fff3cd 0%, #fff3cd 100%);
    border-left: 5px solid #ffc107;
    opacity: 0.7;
}

.day-card.empty-day .meal-name {
    color: #856404;
    font-style: italic;
}

/* 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);
    animation: fadeIn 0.3s;
}

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

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    animation: slideIn 0.3s;
}

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

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

.modal-header h3 {
    color: #667eea;
    margin: 0;
}

.close-modal {
    font-size: 28px;
    font-weight: bold;
    color: #aaa;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    width: 30px;
    height: 30px;
    line-height: 30px;
}

.close-modal:hover {
    color: #000;
    transform: none;
}

.recipe-select-list {
    max-height: 400px;
    overflow-y: auto;
    display: grid;
    gap: 10px;
}

.recipe-select-item {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.recipe-select-item:hover {
    background: #e9ecef;
    border-color: #667eea;
    transform: translateX(5px);
}

.recipe-select-item.selected {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.recipe-select-item.selected .protein-badge {
    background: rgba(255, 255, 255, 0.3);
    color: white;
}

/* Edit Recipe Modal */
.edit-recipe-form {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.edit-recipe-form label {
    font-weight: 600;
    color: #333;
    margin-bottom: -10px;
}

.edit-recipe-form input {
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
}

.edit-recipe-form input:focus {
    outline: none;
    border-color: #667eea;
}

.protein-selector-modal {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.protein-btn-modal {
    flex: 1;
    min-width: 80px;
    padding: 10px 12px;
    font-size: 13px;
    background: #f8f9fa;
    color: #6c757d;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.protein-btn-modal:hover {
    background: #e9ecef;
    border-color: #dee2e6;
    transform: none;
}

.protein-btn-modal.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

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

.cancel-btn {
    flex: 1;
    padding: 12px;
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.cancel-btn:hover {
    background: #5a6268;
}

.save-btn {
    flex: 1;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.save-btn:hover {
    transform: translateY(-2px);
}

/* Hamburger Menu */
.hamburger-btn {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: transform 0.3s;
}

.hamburger-btn:hover {
    transform: scale(1.1);
}

.hamburger-btn span {
    width: 24px;
    height: 3px;
    background: #667eea;
    border-radius: 2px;
    transition: all 0.3s;
}

.hamburger-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Settings Panel */
.settings-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    box-shadow: -5px 0 20px rgba(0,0,0,0.3);
    z-index: 1000;
    transition: right 0.3s ease-in-out;
    overflow-y: auto;
    padding: 0;
}

.settings-panel.open {
    right: 0;
}

.settings-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 25px 30px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.settings-header h2 {
    color: white;
    margin: 0;
    font-size: 1.5em;
}

.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    display: none;
}

.settings-overlay.active {
    display: block;
}

.settings-section {
    padding: 25px 30px;
}

.settings-section h3 {
    color: #333;
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: 600;
}

/* Data Management Section */
.data-management-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 2px solid #dee2e6;
}

.data-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
}

.export-btn,
.import-btn {
    flex: 1;
    padding: 12px 20px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
}

.export-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.export-btn:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8b 100%);
    transform: translateY(-2px);
}

.import-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
}

.import-btn:hover {
    background: linear-gradient(135deg, #218838 0%, #1aa179 100%);
    transform: translateY(-2px);
}

.data-info {
    font-size: 0.85em;
    color: #6c757d;
    margin: 0;
    font-style: italic;
    text-align: center;
}

.edit-recipe-btn {
    padding: 4px 8px;
    background: transparent;
    color: #667eea;
    border: 1px solid #667eea;
    font-size: 12px;
    margin-left: 4px;
}

.edit-recipe-btn:hover {
    background: #667eea;
    color: white;
    transform: none;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        padding: 15px;
        max-width: 100%;
    }

    h1 {
        font-size: 24px;
        margin-bottom: 15px;
    }

    h2 {
        font-size: 18px;
        margin-bottom: 12px;
    }

    h3 {
        font-size: 16px;
    }

    /* Settings Panel - Full Width on Mobile */
    .settings-panel {
        width: 100%;
        right: -100%;
    }

    /* Protein Selector - Stack on Mobile */
    .protein-selector {
        flex-wrap: wrap;
        gap: 6px;
    }

    .protein-btn {
        flex: 1 1 calc(50% - 3px);
        min-width: 120px;
        padding: 10px 8px;
        font-size: 13px;
    }

    /* Search and Filter Row */
    .search-filter-row {
        flex-direction: column;
        gap: 10px;
    }

    .search-box,
    .protein-filter {
        width: 100%;
    }

    /* Recipe Items */
    .recipe-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .recipe-name {
        margin-bottom: 5px;
    }

    .recipe-item > div {
        justify-content: flex-end;
        width: 100%;
    }

    .edit-recipe-btn,
    .delete-btn {
        flex: 1;
        padding: 8px 12px;
    }

    /* Day Selection */
    .day-selection {
        gap: 8px;
    }

    .day-checkbox {
        flex: 1 1 calc(50% - 4px);
        min-width: 140px;
        padding: 10px;
        font-size: 14px;
    }

    /* Quick Select Buttons */
    .quick-select {
        flex-direction: column;
        gap: 8px;
    }

    .quick-select button {
        width: 100%;
        padding: 10px;
        font-size: 14px;
    }

    /* Generate Button */
    .generate-btn {
        padding: 12px;
        font-size: 16px;
    }

    /* Weekly Plan */
    .weekly-plan {
        gap: 10px;
    }

    .day-card {
        padding: 12px;
    }

    .day-name {
        font-size: 14px;
    }

    .meal-name {
        font-size: 15px;
    }

    /* Day Card Buttons */
    .day-card .done-btn,
    .day-card .undo-btn,
    .day-card .edit-day-btn,
    .day-card .clear-day-btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* Modal Content */
    .modal-content {
        width: 95%;
        margin: 10% auto;
        max-height: 80vh;
        overflow-y: auto;
    }

    .modal-header h3 {
        font-size: 18px;
    }

    /* Edit Recipe Modal */
    .protein-selector-modal {
        flex-wrap: wrap;
        gap: 6px;
    }

    .protein-btn-modal {
        flex: 1 1 calc(50% - 3px);
        min-width: 100px;
        padding: 8px 10px;
        font-size: 12px;
    }

    /* Recipe Select List in Modal */
    .recipe-select-list {
        max-height: 40vh;
    }

    .recipe-select-item {
        padding: 12px;
        font-size: 14px;
    }

    /* Hamburger Button */
    .hamburger-btn {
        padding: 10px 15px;
        font-size: 20px;
    }

    /* Settings Panel Content */
    .settings-panel h2 {
        font-size: 18px;
        padding: 15px;
    }

    .settings-content {
        padding: 15px;
    }

    /* Add Recipe Form in Settings */
    .settings-panel input[type="text"] {
        font-size: 15px;
        padding: 10px;
    }

    .settings-panel button {
        padding: 10px 16px;
        font-size: 14px;
    }

    /* Data Management Buttons */
    .data-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .export-btn,
    .import-btn {
        width: 100%;
        padding: 10px 16px;
        font-size: 14px;
    }

    /* Protein Badges */
    .protein-badge {
        font-size: 0.7em;
        padding: 2px 6px;
    }

    .meal-counter-badge {
        font-size: 0.7em;
        padding: 2px 5px;
    }
}

/* Extra Small Mobile Devices */
@media (max-width: 480px) {
    body {
        padding: 5px;
    }

    .container {
        padding: 10px;
    }

    h1 {
        font-size: 20px;
    }

    h2 {
        font-size: 16px;
    }

    /* Protein Buttons - Full Width on Small Screens */
    .protein-btn {
        flex: 1 1 100%;
        min-width: 100%;
    }

    .protein-btn-modal {
        flex: 1 1 100%;
        min-width: 100%;
    }

    /* Day Selection - Full Width */
    .day-checkbox {
        flex: 1 1 100%;
        min-width: 100%;
    }

    /* Modal */
    .modal-content {
        width: 98%;
        margin: 5% auto;
    }

    /* Smaller Text */
    .day-name {
        font-size: 13px;
    }

    .meal-name {
        font-size: 14px;
    }

    .recipe-item {
        font-size: 14px;
    }
}

.meal-counter-badge {
    display: inline-block;
    background: #e9ecef;
    color: #6c757d;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 0.75em;
    font-weight: 600;
    flex-shrink: 0;
    white-space: nowrap;
}

.protein-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    flex-shrink: 0;
    white-space: nowrap;
}

.protein-badge.beef {
    background: #ffe5e5;
    color: #c92a2a;
}

.protein-badge.pork {
    background: #fff0f0;
    color: #e64980;
}

.protein-badge.chicken {
    background: #fff9db;
    color: #e67700;
}

.protein-badge.turkey {
    background: #ffe8cc;
    color: #d9480f;
}

.protein-badge.seafood {
    background: #d0ebff;
    color: #1971c2;
}

.protein-badge.veggie {
    background: #d3f9d8;
    color: #2b8a3e;
}

.done-btn {
    padding: 4px 10px;
    background: #28a745;
    font-size: 13px;
    margin-left: 10px;
}

.done-btn:hover {
    background: #218838;
}

.undo-btn {
    padding: 4px 10px;
    background: #6c757d;
    font-size: 13px;
    margin-left: 10px;
}

.undo-btn:hover {
    background: #5a6268;
}

.day-card.completed {
    opacity: 0.8;
    border-left: 5px solid #28a745;
}

.day-card.completed .meal-name::before {
    content: '✓ ';
    color: #28a745;
    font-weight: bold;
}

.empty-state {
    text-align: center;
    padding: 40px;
    color: #6c757d;
    font-style: italic;
}

.recipe-count {
    color: #6c757d;
    font-size: 0.85em;
    margin-bottom: 12px;
    font-weight: 500;
}

.recipe-item > div {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    align-items: flex-start;
    margin-top: 2px;
}

