/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
    color: #333;
    line-height: 1.6;
}

#app {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
}

.hidden {
    display: none !important;
}

/* Auth Section */
.auth-container {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-align: center;
    margin-top: 60px;
}

.auth-container h1 {
    font-size: 2rem;
    margin-bottom: 10px;
    color: #2196F3;
}

.auth-container p {
    color: #666;
    margin-bottom: 30px;
}

#auth-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-width: 400px;
    margin: 0 auto;
}

#auth-message {
    margin-top: 20px;
    padding: 10px;
    border-radius: 4px;
}

#auth-message.error {
    background-color: #ffebee;
    color: #c62828;
}

#auth-message.success {
    background-color: #e8f5e9;
    color: #2e7d32;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 30px;
}

header h1 {
    font-size: 1.8rem;
    color: #2196F3;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    border-bottom: 2px solid #e0e0e0;
}

.tab-btn {
    padding: 12px 24px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 1rem;
    color: #666;
    transition: all 0.3s;
}

.tab-btn.active {
    color: #2196F3;
    border-bottom-color: #2196F3;
}

.tab-content {
    display: none;
}

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

/* Buttons */
button {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 500;
}

button.primary, #login-btn {
    background-color: #2196F3;
    color: white;
}

button.primary:hover, #login-btn:hover {
    background-color: #1976D2;
}

button.secondary, #signup-btn, #logout-btn {
    background-color: #f5f5f5;
    color: #333;
    border: 1px solid #ddd;
}

button.secondary:hover, #signup-btn:hover, #logout-btn:hover {
    background-color: #e0e0e0;
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Inputs */
input[type="text"],
input[type="email"],
input[type="password"] {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    width: 100%;
}

input:focus {
    outline: none;
    border-color: #2196F3;
}

/* Bins List */
#bins-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
    .bin-card .bin-location {
    color: #666;
    font-size: 0.85rem;
    margin: 5px 0;
}
    .bin-card .bin-description {
    color: #888;
    font-size: 0.85rem;
    font-style: italic;
    margin: 5px 0;
}
}

.bin-card {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s;
}

.bin-card:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.bin-card h3 {
    margin-bottom: 10px;
    color: #2196F3;
}

.bin-card .item-count {
    color: #666;
    font-size: 0.9rem;
}

/* Search */
#search-input {
    margin-bottom: 20px;
}

#search-results {
    display: grid;
    gap: 15px;
}

.search-result-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    gap: 15px;
    align-items: center;
}

.search-result-item img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.search-result-info {
    flex: 1;
}

.search-result-info h4 {
    margin-bottom: 5px;
    color: #333;
}

.search-result-info .bin-name {
    color: #2196F3;
    font-size: 0.9rem;
}

/* Loading Spinner */
#loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2196F3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive */
@media (max-width: 600px) {
    #app {
        padding: 10px;
    }
    
    .auth-container {
        padding: 20px;
    }
    
    #bins-list {
        grid-template-columns: 1fr;
    }
}
/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    line-height: 1;
}

.close-modal:hover {
    color: #333;
}

#modal-bin-name {
    margin-bottom: 20px;
    color: #2196F3;
}

#modal-qr-code {
    text-align: center;
    margin: 20px 0;
    padding: 20px;
    background: #f5f5f5;
    border-radius: 8px;
}

#modal-qr-code canvas {
    max-width: 100%;
    height: auto;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.modal-actions button {
    flex: 1;
}

#modal-items-list {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

#modal-items-list h3 {
    margin-bottom: 15px;
    color: #333;
}
/* Bin Actions */
.bin-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.bin-actions button {
    flex: 1;
    min-width: 200px;
}

/* QR Scanner */
#qr-reader {
    width: 100%;
    max-width: 500px;
    margin: 20px auto;
}

#qr-reader video {
    width: 100%;
    border-radius: 8px;
}

#scanner-status {
    text-align: center;
    color: #666;
    margin: 15px 0;
}

#scanner-status.success {
    color: #2e7d32;
    font-weight: bold;
}

#scanner-status.error {
    color: #c62828;
}

#stop-scan-btn {
    display: block;
    margin: 20px auto 0;
}

.close-scanner {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    font-weight: bold;
    color: #666;
    cursor: pointer;
    line-height: 1;
}

.close-scanner:hover {
    color: #333;
}
/* Danger button */
button.danger {
    background-color: #d32f2f;
    color: white;
}

button.danger:hover {
    background-color: #b71c1c;
}

/* Modal bin info */
.modal-bin-info {
    margin: 20px 0;
    padding: 15px;
    background: #f5f5f5;
    border-radius: 6px;
}

.modal-bin-info p {
    margin: 5px 0;
    color: #666;
}

.modal-bin-info p:empty {
    display: none;
}
/* Items Section */
.items-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.items-header h3 {
    margin: 0;
    color: #333;
}

button.small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

#modal-items-list {
    display: grid;
    gap: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.item-card {
    display: flex;
    gap: 15px;
    background: #f5f5f5;
    padding: 12px;
    border-radius: 6px;
    align-items: center;
}

.item-card img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.item-info {
    flex: 1;
}

.item-info h4 {
    margin: 0 0 5px 0;
    color: #333;
}

.item-info .item-date {
    font-size: 0.85rem;
    color: #666;
}

.item-info .item-description {
    font-size: 0.85rem;
    color: #888;
    margin-top: 4px;
    font-style: italic;
}

.item-card button.danger {
    padding: 6px 12px;
    font-size: 0.85rem;
}

.empty-items {
    text-align: center;
    color: #666;
    padding: 20px;
}

/* Camera Section */
#camera-section {
    margin: 20px 0;
    text-align: center;
}

#camera-preview {
    width: 100%;
    max-width: 400px;
    border-radius: 8px;
    background: #000;
}

#photo-preview {
    margin: 20px 0;
}

#photo-preview img {
    max-width: 100%;
    border-radius: 8px;
}

.camera-controls {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
}

#item-form {
    margin-top: 20px;
}

#item-form input {
    margin-bottom: 15px;
}

#item-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    margin-bottom: 15px;
    resize: vertical;
    min-height: 60px;
}

#item-form textarea:focus {
    outline: none;
    border-color: #2196F3;
}

/* Delete Section */
.delete-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
    text-align: center;
}

/* Item Detail Modal */
.item-detail-content {
    text-align: center;
}

#item-detail-photo {
    margin-bottom: 20px;
}

#item-detail-photo img {
    max-width: 100%;
    max-height: 60vh;
    border-radius: 8px;
    object-fit: contain;
}

#item-detail-name {
    color: #2196F3;
    margin-bottom: 15px;
}

#item-detail-description {
    color: #666;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 15px;
    white-space: pre-wrap;
}

#item-detail-description:empty {
    display: none;
}

#item-detail-date {
    color: #888;
    font-size: 0.9rem;
}

.item-card img,
.item-card .item-info {
    cursor: pointer;
}

.item-card img {
    transition: opacity 0.2s;
}

.item-card img:hover {
    opacity: 0.8;
}

.item-card .item-info:hover h4 {
    color: #2196F3;
}