* {
    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;
    color: #333;
}

/* Authentication Styles */
.auth-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.auth-form {
    background: white;
    padding: 2rem;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.auth-form h1, .auth-form h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: #333;
}

.auth-form input {
    width: 100%;
    padding: 12px;
    margin: 10px 0;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
}

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

.auth-form button {
    width: 100%;
    padding: 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    cursor: pointer;
    margin: 10px 0;
    transition: background 0.3s;
}

.auth-form button:hover {
    background: #5a6fd8;
}

.auth-form p {
    text-align: center;
    margin-top: 1rem;
}

.auth-form a {
    color: #667eea;
    text-decoration: none;
}

.error-message, .success-message {
    padding: 10px;
    margin: 10px 0;
    border-radius: 5px;
    text-align: center;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

/* Main Application Styles */
#app {
    min-height: 100vh;
    background: #f5f5f5;
}

header {
    background: white;
    padding: 1rem 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-right: 2rem;
}

header h1 {
    color: #333;
    margin: 0;
}

.version-badge {
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

nav {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.nav-btn, .logout-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    text-decoration: none;
    transition: background 0.3s;
}

.nav-btn {
    background: #6c757d;
    color: white;
}

.nav-btn.active, .nav-btn:hover {
    background: #667eea;
}

.logout-btn {
    background: #dc3545;
    color: white;
}

.logout-btn:hover {
    background: #c82333;
}

.username {
    color: #666;
    margin: 0 1rem;
}

/* Content Sections */
.content-section {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.content-section.hidden {
    display: none;
}

.content-section h2 {
    margin-bottom: 2rem;
    color: #333;
}

/* Forms */
.add-bed-form, .add-seed-form {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.add-bed-form h3, .add-seed-form h3 {
    margin-bottom: 1rem;
    color: #333;
}

.add-bed-form form {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: end;
}

.add-seed-form form {
    display: block;
}

.add-seed-form .form-group {
    margin-bottom: 1rem;
}

.add-seed-form .form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #333;
}

.add-seed-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.add-seed-form .form-row .form-group {
    margin-bottom: 0;
}

.add-bed-form input, .add-seed-form input {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    flex: 1;
    min-width: 150px;
}

.add-bed-form input:focus, .add-seed-form input:focus {
    outline: none;
    border-color: #667eea;
}

.add-seed-form input[type="color"] {
    width: 100%;
    height: 42px;
    padding: 2px;
    border: 2px solid #ddd;
    cursor: pointer;
}

.add-bed-form button {
    padding: 10px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.add-seed-form button {
    padding: 10px 20px;
    background: #28a745;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
    margin-top: 1rem;
    min-width: 150px;
}

.add-bed-form button:hover, .add-seed-form button:hover {
    background: #218838;
}

/* Bed Items */
.bed-item {
    background: white;
    padding: 1rem;
    margin: 10px 0;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bed-info {
    flex: 1;
}

.bed-name {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 5px;
    color: #333;
}

.bed-dimensions {
    color: #666;
    font-size: 14px;
}

.delete-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s;
}

.delete-btn:hover {
    background: #c82333;
}

.seed-actions .delete-btn {
    flex: 1;
}

/* Seeds Section */
#seeds-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.seed-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 1.5rem;
    transition: transform 0.3s;
    position: relative;
}

.seed-card:hover {
    transform: translateY(-2px);
}

.seed-card h4 {
    color: #333;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.seed-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: inline-block;
    border: 2px solid #ddd;
}

.seed-card p {
    margin: 8px 0;
    font-size: 14px;
    color: #666;
}

.seed-card strong {
    color: #333;
}

.seed-actions {
    display: flex;
    gap: 10px;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.edit-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: background 0.3s;
    flex: 1;
}

.edit-btn:hover {
    background: #0056b3;
}

/* Garden Controls */
.garden-controls {
    background: white;
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    flex-wrap: wrap;
}

/* Seed Selection */
.seed-selection {
    flex: 1;
    min-width: 300px;
}

.seed-selection h4 {
    margin-bottom: 1rem;
    color: #333;
}

.seed-quantity-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #f9f9f9;
}

.seed-quantity-item {
    background: white;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    transition: all 0.3s;
}

.seed-quantity-item:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.seed-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin-bottom: 10px;
}

.seed-checkbox input[type="checkbox"] {
    margin: 0;
    transform: scale(1.3);
}

.seed-color-indicator {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid #ddd;
    display: inline-block;
}

.seed-name {
    font-weight: 500;
    color: #333;
    flex: 1;
}

.quantity-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 5px;
    transition: all 0.3s;
}

.quantity-input {
    width: 80px;
    padding: 6px 10px;
    border: 2px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    text-align: center;
}

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

.quantity-label {
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

.garden-controls select {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    min-width: 250px;
    flex: 1;
}

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

.garden-controls button {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
}

.plan-btn {
    background: #28a745;
    color: white;
}

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

.clear-btn {
    background: #ffc107;
    color: #333;
}

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

/* Garden View */
#garden-view {
    background: white;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 2rem;
    min-height: 400px;
    position: relative;
    overflow: hidden;
    cursor: grab;
}

#garden-view.dragging {
    cursor: grabbing;
}

.garden-container {
    position: relative;
    transform-origin: 0 0;
    transition: transform 0.1s ease-out;
    min-width: 100%;
    min-height: 100%;
}

.zoom-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
    z-index: 1000;
}

.zoom-btn {
    width: 35px;
    height: 35px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    font-size: 18px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: background 0.2s;
}

.zoom-btn:hover {
    background: rgba(102, 126, 234, 0.1);
}

.zoom-btn:active {
    background: rgba(102, 126, 234, 0.2);
}

.zoom-info {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 3px;
    font-size: 12px;
    z-index: 1000;
}

.garden-bed {
    border: 3px solid #333;
    margin: 60px;
    position: relative;
    display: inline-block;
    background: linear-gradient(45deg, #8B4513 25%, #A0522D 25%, #A0522D 50%, #8B4513 50%, #8B4513 75%, #A0522D 75%);
    background-size: 10px 10px;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.garden-bed-label {
    position: absolute;
    top: -30px;
    left: 0;
    background: #333;
    color: white;
    padding: 4px 12px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Technical dimension lines */
.dimension-horizontal {
    position: absolute;
    bottom: -45px;
    left: 0;
    right: 0;
    height: 20px;
    pointer-events: none;
}

.dimension-vertical {
    position: absolute;
    top: 0;
    bottom: 0;
    right: -45px;
    width: 20px;
    pointer-events: none;
}

.dimension-line {
    position: absolute;
    background: #666;
}

.dimension-horizontal .dimension-line {
    height: 1px;
    top: 10px;
    left: 0;
    right: 0;
}

.dimension-vertical .dimension-line {
    width: 1px;
    left: 10px;
    top: 0;
    bottom: 0;
}

.dimension-horizontal .dimension-arrow-left,
.dimension-horizontal .dimension-arrow-right {
    position: absolute;
    top: 6px;
    width: 0;
    height: 0;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
}

.dimension-horizontal .dimension-arrow-left {
    left: 0;
    border-right: 8px solid #666;
}

.dimension-horizontal .dimension-arrow-right {
    right: 0;
    border-left: 8px solid #666;
}

.dimension-vertical .dimension-arrow-top,
.dimension-vertical .dimension-arrow-bottom {
    position: absolute;
    left: 6px;
    width: 0;
    height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
}

.dimension-vertical .dimension-arrow-top {
    top: 0;
    border-bottom: 8px solid #666;
}

.dimension-vertical .dimension-arrow-bottom {
    bottom: 0;
    border-top: 8px solid #666;
}

.dimension-text {
    position: absolute;
    background: white;
    padding: 2px 6px;
    border: 1px solid #666;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    color: #333;
    white-space: nowrap;
}

.dimension-horizontal .dimension-text {
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
}

.dimension-vertical .dimension-text {
    left: -8px;
    top: 50%;
    transform: translateY(-50%) rotate(-90deg);
    transform-origin: center;
}

.plant-spot {
    position: absolute;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s;
    border: 2px solid rgba(255,255,255,0.8);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.plant-spot:hover {
    transform: scale(1.3);
    z-index: 10;
    border-color: #fff;
}

.tooltip {
    position: fixed;
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 10000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    min-width: 120px;
    text-align: center;
    transform: scale(1) !important;
}

/* Tooltips are now handled via JavaScript */

/* Responsive Design */
@media (max-width: 768px) {
    header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .add-bed-form form {
        flex-direction: column;
    }
    
    .add-bed-form input {
        min-width: 100%;
    }
    
    .add-seed-form .form-row {
        grid-template-columns: 1fr;
    }
    
    .garden-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .garden-controls select {
        min-width: 100%;
    }
    
    .seeds-grid {
        grid-template-columns: 1fr;
    }
    
    .bed-item {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
}

/* Loading and Status Messages */
.loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.no-data {
    text-align: center;
    padding: 3rem;
    color: #666;
    font-style: italic;
}

/* Animation for new items */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bed-item, .seed-card {
    animation: slideIn 0.3s ease-out;
}

/* Footer */
footer {
    background: #333;
    color: white;
    padding: 1rem 2rem;
    margin-top: 2rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-version {
    font-size: 14px;
}

.footer-info {
    font-size: 12px;
    color: #ccc;
}

@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .header-left {
        flex-direction: column;
        gap: 0.5rem;
        margin-right: 1rem;
    }
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(3px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}

.modal-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.25rem;
}

.close-modal {
    color: #999;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
    line-height: 1;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

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

.modal-body {
    padding: 1.5rem;
}

.form-group {
    margin-bottom: 1rem;
}

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

.form-group input {
    width: 100%;
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 5px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input[type="color"] {
    height: 42px;
    padding: 2px;
    cursor: pointer;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-row .form-group {
    margin-bottom: 0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid #eee;
    background-color: #f9f9f9;
    border-radius: 0 0 10px 10px;
}

.btn-cancel, .btn-save {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    min-width: 100px;
}

.btn-cancel {
    background-color: #6c757d;
    color: white;
}

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

.btn-save {
    background-color: #28a745;
    color: white;
}

.btn-save:hover {
    background-color: #218838;
}

@media (max-width: 768px) {
    .modal-content {
        margin: 2% auto;
        width: 95%;
        max-height: 95vh;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .btn-cancel, .btn-save {
        width: 100%;
    }
}