* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #4b55a2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.header h1 {
    color: #667eea;
    margin-bottom: 10px;
}

.header p {
    color: #666;
}

.form-section {
    background: white;
    border-radius: 15px;
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.form-section h2 {
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #667eea;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-field.full-width {
    grid-column: 1 / -1;
}

label {
    font-weight: 600;
    color: #333;
}

label.required:after {
    content: " *";
    color: #dc2626;
}

input, select, textarea {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.commodities-table-container {
    overflow-x: auto;
}

.commodities-table {
    width: 100%;
    border-collapse: collapse;
}

.commodities-table th,
.commodities-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.commodities-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.commodities-table td {
    color: #555;
}

.quantity-input, .amount-input {
    width: 100%;
    padding: 8px;
}

button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    width: 100%;
}

button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.admin-link {
    text-align: center;
    margin-top: 20px;
}

.admin-link a {
    color: white;
    text-decoration: none;
    font-weight: 600;
}

.admin-link a:hover {
    text-decoration: underline;
}

/* Alert Messages */
.alert {
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid #10b981;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #dc2626;
}

/* Login Page */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-container {
    max-width: 400px;
    width: 100%;
}

.login-card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header i {
    font-size: 50px;
    color: #667eea;
    margin-bottom: 15px;
}

.login-header h2 {
    color: #333;
    margin-bottom: 5px;
}

.login-header p {
    color: #666;
}

/* Dashboard Styles */
.dashboard-container {
    max-width: 1600px;
    margin: 0 auto;
}

.dashboard-header {
    background: white;
    border-radius: 15px;
    padding: 20px 30px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.dashboard-header h1 {
    color: #333;
    font-size: 24px;
}

.dashboard-header p {
    color: #666;
    margin-top: 5px;
}

.logout-btn {
    width: auto;
    background: #dc2626;
    padding: 10px 20px;
}

.logout-btn:hover {
    background: #b91c1c;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-card i {
    font-size: 30px;
    color: #667eea;
    margin-bottom: 10px;
}

.stat-number {
    font-size: 28px;
    font-weight: bold;
    color: #333;
}

.stat-label {
    color: #666;
    font-size: 14px;
}

.dashboard-controls {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.search-box {
    flex: 1;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}

.search-box input {
    width: 100%;
    padding: 10px 10px 10px 35px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.export-buttons {
    display: flex;
    gap: 10px;
}

.export-btn, .refresh-btn {
    width: auto;
    padding: 10px 20px;
    font-size: 14px;
}

.table-container {
    background: white;
    border-radius: 12px;
    padding: 20px;
    overflow-x: auto;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.submission-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    border-left: 4px solid #667eea;
}

.submission-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ddd;
}

.submission-hospital {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.submission-date {
    color: #666;
    font-size: 14px;
}

.submission-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.detail-item {
    padding: 8px;
    background: white;
    border-radius: 8px;
}

.detail-label {
    font-weight: 600;
    color: #667eea;
    font-size: 12px;
    text-transform: uppercase;
}

.detail-value {
    color: #333;
    margin-top: 5px;
}

.commodities-grid {
    margin-top: 15px;
}

.commodity-row {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    border-bottom: 1px solid #eee;
}

.commodity-name {
    font-weight: 500;
}

.commodity-data {
    display: flex;
    gap: 20px;
}

.commodity-quantity, .commodity-amount {
    font-size: 14px;
}

.documents-list {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
}

.documents-list a {
    color: #667eea;
    text-decoration: none;
    margin-right: 15px;
    font-size: 14px;
}

.documents-list a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .form-section {
        padding: 15px;
    }
    
    .commodities-table th,
    .commodities-table td {
        padding: 8px;
        font-size: 12px;
    }
    
    .dashboard-header {
        flex-direction: column;
        text-align: center;
    }
    
    .dashboard-controls {
        flex-direction: column;
    }
    
    .search-box {
        width: 100%;
    }
    
    .export-buttons {
        width: 100%;
        justify-content: stretch;
    }
    
    .export-btn, .refresh-btn {
        flex: 1;
    }
}

/* Multi-select styling */
select[multiple] {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px;
}

select[multiple] option {
    padding: 8px 12px;
    margin: 2px 0;
    border-radius: 6px;
    cursor: pointer;
}

select[multiple] option:hover {
    background: #eef2ff;
}

select[multiple] option:checked {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* Selected funding source display */
.selected-funding-sources {
    margin-top: 8px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 13px;
    color: #666;
}

.selected-funding-sources strong {
    color: #667eea;
}

/* Tag Input System Styles */
.tag-input-container {
    border: 1px solid #ddd;
    border-radius: 8px;
    background: white;
    transition: all 0.3s;
}

.tag-input-container:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.selected-tags {
    min-height: 60px;
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
}

.placeholder-text {
    color: #999;
    font-size: 14px;
    font-style: italic;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    animation: tagFadeIn 0.2s ease;
}

@keyframes tagFadeIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.tag-remove {
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    padding: 0 4px;
    border-radius: 50%;
    transition: all 0.2s;
}

.tag-remove:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.2);
}

.tag-dropdown {
    position: relative;
}

.tag-dropdown input {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
}

.tag-options {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tag-option {
    padding: 10px 15px;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 14px;
}

.tag-option:hover {
    background: #f0f0f0;
}

.tag-option.no-results {
    color: #999;
    text-align: center;
    cursor: default;
}

.tag-option.no-results:hover {
    background: white;
}