/* Mobile optimizations for Studio Manager app */

/* Add safe area padding for notched iPhones */
.container {
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    padding-top: max(20px, env(safe-area-inset-top));
    padding-bottom: calc(80px + env(safe-area-inset-bottom)); /* Account for bottom nav only */
}

/* Status bar spacing for iOS devices */
.status-bar-space {
    padding-top: env(safe-area-inset-top);
    min-height: env(safe-area-inset-top, 20px);
}

/* Improve touch targets for mobile */
.grid-item, 
.button,
.nav-item,
.recipe-item,
input, 
select, 
textarea, 
button {
    min-height: 44px; /* Apple's recommended minimum touch target size */
}

/* Better button/input appearance on iOS */
input, 
select, 
textarea, 
button {
    -webkit-appearance: none;
    appearance: none;
    border-radius: 8px;
}

/* Fix scrolling on iOS */
body {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: none;
}

/* Body scroll lock when modal is open */
body.modal-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* Fix tap highlight on iOS */
a, button {
    -webkit-tap-highlight-color: transparent;
}

/* Adjust bottom nav for iPhones with home indicator */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: var(--background);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    z-index: 100;
}

/* ====== NEW MODAL DESIGN ====== */
/* Modal container */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999;
    display: none;
    overflow: hidden;
    align-items: center;
    justify-content: center;
    animation: modalFadeIn 0.2s ease;
}

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

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

/* Modal content container */
.modal-inner {
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    background-color: var(--card-bg);
    border-radius: var(--radius-lg, 16px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: var(--shadow-md, 0 4px 20px rgba(0, 0, 0, 0.4));
    animation: modalSlideUp 0.25s ease;
}

/* Modal header */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background-color: var(--surface);
}

.modal-title {
    color: var(--accent-color);
    margin: 0;
    font-size: 1.4rem;
    font-weight: 600;
}

.modal-close {
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    position: relative;
    background-color: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-color);
    color: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.modal-close::before,
.modal-close::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: var(--text-color);
}

.modal-close::before {
    transform: rotate(45deg);
}

.modal-close::after {
    transform: rotate(-45deg);
}

.modal-close:hover,
.modal-close:focus-visible {
    background-color: rgba(200, 255, 0, 0.12);
    border-color: var(--accent-color);
    outline: none;
}

/* Modal body - scrollable content */
.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
    max-height: calc(80vh - 60px); /* Account for header height */
}

/* Modal footer */
.modal-footer {
    padding: 16px;
    border-top: 1px solid #333;
    background-color: #1e1e1e;
    border-radius: 0 0 16px 16px;
    z-index: 10;
}

/* Recipe section styles */
.recipe-section {
    background: var(--card-bg);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.recipe-section h4 {
    color: var(--accent-color);
    margin-top: 0;
    margin-bottom: 12px;
}

/* Recipe header */
.recipe-header {
    display: flex;
    align-items: center;
    background: var(--card-bg);
    padding: 16px;
    border-radius: 12px; 
    margin-bottom: 16px;
}

.recipe-icon {
    margin-right: 16px;
    color: var(--accent-color);
    font-size: 2rem;
}

/* Recipe details grid */
.recipe-details {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    background: var(--card-bg);
    padding: 16px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.detail-item .label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.detail-item .value {
    font-weight: 500;
    font-size: 1.1rem;
}

/* Ingredients table */
.ingredients-table {
    width: 100%;
}

.ingredients-header {
    display: flex;
    background-color: rgba(200, 255, 0, 0.15);
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.ingredients-header .material-col {
    flex: 1;
    font-weight: 500;
}

.ingredients-header .amount-col {
    width: 80px;
    text-align: right;
    font-weight: 500;
}

#ingredientsList {
    max-height: 200px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.ingredient-row {
    display: flex;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-color);
}

.ingredient-row .material-col {
    flex: 1;
}

.ingredient-row .amount-col {
    width: 80px;
    text-align: right;
    font-weight: 500;
}

/* Action buttons */
.modal-actions {
    display: flex;
    gap: 12px;
}

.modal-actions .button {
    flex: 1;
}

/* Form styling */
.form-group {
    margin-bottom: 16px;
}

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

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid #444;
    color: var(--text-color);
    border-radius: 8px;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .recipe-details {
        grid-template-columns: 1fr;
    }
    
    .modal-actions {
        flex-direction: column;
    }
}

/* Consistent recipe/inventory item styling */
.recipe-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background-color: var(--card-bg);
    margin-bottom: 8px;
    border-radius: 12px;
    color: var(--text-color);
    text-decoration: none;
    position: relative;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.recipe-item:active,
.recipe-item:hover {
    background-color: rgba(96, 125, 39, 0.1);
}

/* Recipe item details */
.recipe-name {
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recipe-thumbnail {
    width: 50px;
    height: 50px;
    min-width: 50px;
    margin-right: 12px;
    border-radius: 6px;
    overflow: hidden;
    background-color: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
    font-size: 0;
}

.recipe-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: #262626;
    font-size: 0;
    line-height: 0;
}

.recipe-thumbnail i {
    font-size: 24px;
    color: var(--accent-color);
    opacity: 0.9;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.recipe-info {
    flex: 1;
    min-width: 0;
}

.recipe-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Inventory specific styles */
.item-thumbnail {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--surface);
    border-radius: 8px;
    overflow: hidden;
    margin-right: 12px;
    font-size: 0;
    line-height: 0;
}

.item-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.item-thumbnail i {
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.card-details .quantity {
    color: var(--primary);
    font-weight: 500;
    margin-right: 8px;
}

.card-details .category {
    background-color: var(--surface);
    color: var(--text-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    margin-right: 8px;
}

.card-details .location {
    color: var(--text-secondary);
    font-size: 0.85em;
}

.image-upload-container {
    margin-bottom: 20px;
}

.image-preview-container {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 8px;
}

#image-preview {
    width: 80px;
    height: 80px;
    background-color: var(--surface);
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#image-preview .placeholder-icon {
    font-size: 32px;
    color: var(--primary);
}

.image-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.upload-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background-color: var(--primary);
    color: #000000;  /* Black text on lime green button */
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
    font-weight: 600;
}

.remove-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background-color: var(--danger);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9em;
}

/* Filter buttons styling */
.filter-buttons {
    display: flex;
    gap: 8px;
    margin: 0 0 16px 0;
    padding: 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.filter-button {
    padding: 8px 16px;
    border: none;
    background-color: rgba(30, 30, 30, 0.8);
    color: var(--text-color);
    border-radius: 20px;
    font-size: 0.9em;
    white-space: nowrap;
    min-width: 80px;
    text-align: center;
}

.filter-button.active {
    background-color: var(--accent-color);
    color: #000000;  /* Black text on lime green button */
    font-weight: 600;
}

/* Ensure cards display properly */
.card {
    display: flex;
    align-items: center;
    background-color: var(--surface);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 10px;
    transition: background-color 0.2s;
}

.card:active {
    background-color: var(--surface-pressed);
}

.card-content {
    flex: 1;
    overflow: hidden;
}

.card-title {
    font-weight: 500;
    margin-bottom: 4px;
    color: var(--text);
}

.card-details {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 0.9em;
    color: var(--text-secondary);
}

/* Make sure modals display properly */
.modal-content {
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

/* Add proper spacing for the card list */
.card-list, .recipe-list {
    margin: 0 0 80px 0;
    padding: 0;
}

/* Loading and empty states */
.loading-container, .empty-state, .error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.loading-spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

.empty-state i, .error-state i {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.empty-state p, .error-state p {
    margin-bottom: 16px;
    color: var(--text-secondary);
}

/* Proper form styling */
.form-group {
    margin-bottom: 16px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-row .form-group {
    flex: 1;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
}

label .required {
    color: var(--danger);
}

input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background-color: var(--background);
    color: var(--text);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    outline: none;
}

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

button {
    cursor: pointer;
}

.primary-button, .secondary-button, .danger-button {
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 500;
    border: none;
}

.primary-button {
    background-color: var(--primary);
    color: #000000;  /* Black text on lime green button */
    font-weight: 600;
}

.secondary-button {
    background-color: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.danger-button {
    background-color: var(--danger);
    color: white;
}

.primary-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Ensure app-container takes full height */
#app-container {
    min-height: 100vh;
}

/* Consistent header styling for all pages */
header {
    padding: 4px 0 16px 0;
    margin-bottom: 0;
}

header h1 {
    color: var(--accent-color);
    font-size: 28px;
    font-weight: 600;
    margin: 0;
    padding: 0;
    text-align: left;
}

/* Consistent search bar styling for all pages */
.search-bar {
    margin: 0 0 16px 0;
}

.search-bar input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    background-color: rgba(30, 30, 30, 0.8);
    border: none;
    color: var(--text-color);
    font-size: 16px;
}

.search-bar input::placeholder {
    color: var(--text-secondary);
}

/* Action button styling */
.add-button {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--accent-color);
    color: #000000;
    font-weight: 600;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    cursor: pointer;
}

.add-button i {
    margin-right: 8px;
}

/* Action button container */
.action-button-container {
    margin: 0 0 16px 0;
} 
