/* static/css/home.css */
body { 
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.app-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.card-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 2rem;
    width: 100%;
    max-width: 500px;
}

.logo {
    font-size: 3rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
}

.title {
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
}

.subtitle {
    color: #718096;
    margin-bottom: 2rem;
    font-size: 1rem;
}

.input-group-mobile {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.form-input {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

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

.btn-primary-mobile {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary-mobile:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-primary-mobile:active {
    transform: translateY(0);
}

.info-text {
    color: #718096;
    font-size: 0.9rem;
    line-height: 1.4;
}

.error-alert {
    border-radius: 12px;
    border: none;
    background: rgba(254, 215, 215, 0.9);
    color: #c53030;
    padding: 1rem;
    margin-bottom: 1.5rem;
    font-weight: 500;
}

/* Mobile-first responsive design */
@media (max-width: 576px) {
    .app-container {
        padding: 15px;
        align-items: flex-start;
        padding-top: 3rem;
    }
    
    .card-container {
        padding: 1.5rem;
        border-radius: 16px;
    }
    
    .logo {
        font-size: 2.5rem;
    }
    
    .title {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.9rem;
        margin-bottom: 1.5rem;
    }
    
    .form-input {
        padding: 0.875rem;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .btn-primary-mobile {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    .info-text {
        font-size: 0.85rem;
    }
}

@media (max-width: 400px) {
    .card-container {
        padding: 1.25rem;
    }
    
    .logo {
        font-size: 2rem;
    }
    
    .title {
        font-size: 1.3rem;
    }
    
    .form-input {
        padding: 0.75rem;
    }
}

/* Landscape mode optimization */
@media (max-height: 600px) and (orientation: landscape) {
    .app-container {
        padding-top: 1rem;
        padding-bottom: 1rem;
    }
    
    .card-container {
        padding: 1.5rem;
    }
    
    .logo {
        font-size: 2rem;
        margin-bottom: 0.5rem;
    }
    
    .title {
        font-size: 1.3rem;
        margin-bottom: 0.25rem;
    }
    
    .subtitle {
        margin-bottom: 1rem;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .card-container {
        background: rgba(45, 55, 72, 0.95);
        color: white;
    }
    
    .title {
        color: white;
    }
    
    .subtitle {
        color: #cbd5e0;
    }
    
    .form-input {
        background: #4a5568;
        border-color: #718096;
        color: white;
    }
    
    .form-input::placeholder {
        color: #a0aec0;
    }
    
    .info-text {
        color: #cbd5e0;
    }
}

/* Loading state */
.btn-loading {
    position: relative;
    color: transparent;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Bucket History Dropdown Styles */
.input-with-dropdown {
    position: relative;
    display: flex;
    align-items: stretch;
}

.dropdown-container {
    position: relative;
    display: flex;
}

.dropdown-toggle {
    background: #f8f9fa;
    border: 2px solid #e2e8f0;
    border-left: none;
    border-radius: 0 12px 12px 0;
    padding: 0 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #718096;
    position: relative;
    z-index: 1;
}

.dropdown-toggle:hover {
    background: #e9ecef;
    color: #495057;
}
/* Hide Bootstrap's default caret */
.dropdown-toggle::after {
    display: none !important;
}


.form-input {
    border-radius: 12px 0 0 12px !important;
    flex: 1;
    border-right: none !important;
}

.history-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e2e8f0;
    border-top: none;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    display: none;
    max-height: 200px;
    overflow-y: auto;
}

.history-dropdown.show {
    display: block;
}

.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #495057;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.clear-history-btn,
.clear-single-btn {
    background: none;
    border: none;
    color: #718096;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.clear-history-btn:hover {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.clear-single-btn:hover {
    color: #fd7e14;
    background: rgba(253, 126, 20, 0.1);
}

.dropdown-items {
    padding: 0.5rem 0;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 0.9rem;
    color: #495057;
    gap: 0.5rem;
}

.history-item-content {
    flex: 1;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.history-item-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-item-delete {
    background: none;
    border: none;
    color: #718096;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    opacity: 0;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.history-item:hover .history-item-delete {
    opacity: 1;
}

.history-item-delete:hover {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.history-item:hover {
    background: #f8f9fa;
    color: #667eea;
}

.history-item:active {
    background: #e9ecef;
}

.history-item.empty {
    color: #718096;
    font-style: italic;
    cursor: default;
}

.history-item.empty:hover {
    background: none;
    color: #718096;
}

/* Focus states for accessibility */
.form-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    outline: none;
    z-index: 2;
}

.form-input:focus + .dropdown-container .dropdown-toggle {
    border-color: #667eea;
    z-index: 2;
}

/* Dark mode support for dropdown */
@media (prefers-color-scheme: dark) {
    .dropdown-toggle {
        background: #4a5568;
        border-color: #718096;
        color: #cbd5e0;
    }
    
    .dropdown-toggle:hover {
        background: #5a6578;
        color: white;
    }
    
    .history-dropdown {
        background: #4a5568;
        border-color: #718096;
    }
    
    .dropdown-header {
        background: #2d3748;
        color: #e2e8f0;
        border-bottom-color: #718096;
    }
    
    .history-item {
        color: #e2e8f0;
    }
    
    .history-item:hover {
        background: #5a6578;
        color: #667eea;
    }
    
    .history-item.empty {
        color: #a0aec0;
    }
    
    .clear-history-btn,
    .clear-single-btn {
        color: #a0aec0;
    }
    
    .clear-history-btn:hover {
        color: #fc8181;
        background: rgba(252, 129, 129, 0.1);
    }
    
    .clear-single-btn:hover {
        color: #f6ad55;
        background: rgba(246, 173, 85, 0.1);
    }
    
    .history-item-delete {
        color: #cecfd1;
    }
    
    .history-item-delete:hover {
        color: #fc8181;
        background: rgba(252, 129, 129, 0.1);
    }
}

/* Mobile responsiveness for dropdown */
@media (max-width: 576px) {
    .dropdown-toggle {
        padding: 0 0.875rem;
    }
    
    .history-dropdown {
        max-height: 150px;
    }
    
    .history-item {
        padding: 0.875rem 1rem;
    }
    
    .history-item-delete {
        opacity: 1; /* Always show delete button on mobile */
    }
    
    .header-actions {
        gap: 0.25rem;
    }
}

/* Individual history item delete button */
.history-item {
    display: flex;
    justify-content: between;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-size: 0.9rem;
    color: #cecfd1;
    position: relative;
}

.history-item-content {
    flex: 1;
    display: flex;
    align-items: center;
}


.history-item:hover .history-item-delete {
    opacity: 1;
}

.history-item-delete:hover {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

/* Clear all button styles */
.clear-history-btn {
    background: none;
    border: none;
    color: #718096;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.clear-history-btn:hover {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

/* Dropdown header improvements */
.dropdown-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #4a5568;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #cecfd1;
}

.dropdown-header-actions {
    display: flex;
    gap: 0.5rem;
}

/* Dark mode support for new elements */
@media (prefers-color-scheme: dark) {
    .history-item-delete {
        color: #cecfd1;
    }
    
    .history-item-delete:hover {
        color: #fc8181;
        background: rgba(252, 129, 129, 0.1);
    }
    
    .clear-history-btn {
        color: #cecfd1;
    }
    
    .clear-history-btn:hover {
        color: #fc8181;
        background: rgba(252, 129, 129, 0.1);
    }
}
