/* 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: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    min-height: 100vh;
    color: #1f2937;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

header h1 i {
    margin-right: 15px;
    color: #eab308;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Controls */
.controls {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    align-items: center;
    flex-wrap: wrap;
}

.search-container {
    position: relative;
    margin-left: auto;
}

.info-badge {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-input {
    padding: 12px 45px 12px 15px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    width: 250px;
    background: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #666;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.btn-primary {
    background: #1e40af;
    color: white;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-success {
    background: #059669;
    color: white;
}

.btn-success:hover {
    background: #047857;
}

.btn-secondary {
    background: #475569;
    color: white;
}

.btn-secondary:hover {
    background: #374151;
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-edit {
    background: #0f766e;
    color: white;
    padding: 8px 16px;
    font-size: 12px;
}

.btn-edit:hover {
    background: #0d9488;
}

.btn-delete {
    background: #ef4444;
    color: white;
    padding: 8px 16px;
    font-size: 12px;
}

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

/* Loading and Error */
.loading, .error {
    text-align: center;
    padding: 40px;
    margin: 20px 0;
}

.loading {
    color: white;
    font-size: 18px;
}

.loading i {
    font-size: 24px;
    margin-right: 10px;
}

.error {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #dc2626;
    border-radius: 12px;
    border: 1px solid #fecaca;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.1);
}

.error-content h3 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: #b91c1c;
}

.error-help {
    background: rgba(255, 255, 255, 0.8);
    padding: 20px;
    border-radius: 8px;
    margin-top: 20px;
    text-align: left;
}

.error-help h4 {
    color: #374151;
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.error-help ul {
    color: #64748b;
    margin-bottom: 15px;
    padding-left: 20px;
}

.error-help li {
    margin-bottom: 8px;
    line-height: 1.5;
}

.error-help code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #1f2937;
    font-size: 0.9rem;
}

.error-help a {
    color: #2563eb;
    text-decoration: none;
}

.error-help a:hover {
    text-decoration: underline;
}

.hidden {
    display: none !important;
}

/* View Toggle Buttons */
.view-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    padding: 2px;
}

.btn-view {
    background: transparent;
    color: white;
    border: none;
    padding: 8px 12px;
    margin: 0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.btn-view:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-view.active {
    background: white;
    color: #1e40af;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

/* List View Styles */
.projects-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.project-list-item {
    background: white;
    border-radius: 8px;
    padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.2s ease;
    border-left: 4px solid #1e40af;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 70px;
}

.project-list-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.project-list-info {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
}

.project-list-main {
    flex: 1;
    min-width: 0;
}

.project-list-name {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 4px;
}

.project-list-code {
    font-size: 14px;
    color: #1e40af;
    font-weight: 500;
}

.project-list-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 14px;
    color: #64748b;
}

.project-list-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.project-list-actions .btn {
    padding: 6px 12px;
    font-size: 12px;
}

.project-card {
    background: white;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    border-left: 4px solid #1e40af;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.project-code {
    font-size: 18px;
    font-weight: bold;
    color: #1e40af;
    margin-bottom: 5px;
}

.project-name {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 10px;
}

.project-description {
    color: #64748b;
    font-size: 14px;
    line-height: 1.5;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.status-badge, .priority-badge {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-active { background: #d1fae5; color: #059669; }
.status-inactive { background: #fee2e2; color: #dc2626; }
.status-completed { background: #dbeafe; color: #2563eb; }
.status-on-hold { background: #fef3c7; color: #ca8a04; }

.priority-low { background: #f1f5f9; color: #64748b; }
.priority-medium { background: #fef3c7; color: #ca8a04; }
.priority-high { background: #fed7aa; color: #ea580c; }
.priority-critical { background: #fee2e2; color: #dc2626; }

.status-sox-compliant { background: #dbeafe; color: #2563eb; }

.project-budget {
    margin-bottom: 15px;
}

.budget-bar {
    width: 100%;
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.budget-used {
    height: 100%;
    background: linear-gradient(90deg, #059669, #ca8a04, #dc2626);
    transition: width 0.3s ease;
}

.project-details {
    font-size: 14px;
    margin-bottom: 15px;
}

.project-details div {
    margin-bottom: 5px;
}

.sox-badge {
    background: #dbeafe;
    color: #2563eb;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.project-wiki {
    margin-bottom: 15px;
}

.wiki-link {
    color: #1e40af;
    text-decoration: none;
    font-weight: 600;
}

.wiki-link:hover {
    text-decoration: underline;
}

.project-details-modal h3 {
    margin-bottom: 20px;
    color: #1f2937;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 10px;
}

.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
}

.details-grid div {
    padding: 8px;
    background: #f9fafb;
    border-radius: 4px;
}

.wiki-section, .tags-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
}

.project-dates {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 15px;
}

.project-tags {
    margin-bottom: 15px;
}

.tag {
    display: inline-block;
    background: #f1f5f9;
    color: #475569;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    margin-right: 5px;
    margin-bottom: 5px;
}

.project-actions {
    display: flex;
    gap: 10px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

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

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

.modal-header {
    padding: 24px 30px 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    color: white;
    border-radius: 16px 16px 0 0;
}

.modal-title-section h2 {
    margin: 0 0 5px 0;
    color: white;
    font-size: 24px;
    font-weight: 600;
}

.modal-subtitle {
    margin: 0;
    color: rgba(255,255,255,0.9);
    font-size: 14px;
    font-weight: 400;
}

.close {
    font-size: 28px;
    cursor: pointer;
    color: rgba(255,255,255,0.8);
    transition: all 0.3s ease;
    line-height: 1;
    padding: 4px;
    border-radius: 50%;
}

.close:hover {
    color: white;
    background: rgba(255,255,255,0.1);
}

.modal-body {
    padding: 24px;
}

.form-body {
    padding: 30px;
    background: #fafafa;
}

.form-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid #e5e7eb;
}

.section-title {
    margin: 0 0 20px 0;
    color: #374151;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
}

.section-title i {
    color: #1e40af;
}

/* Forms */
.form-group {
    margin-bottom: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    font-weight: 600;
    color: #374151;
    font-size: 14px;
}

label i {
    color: #1e40af;
    width: 16px;
}

.tooltip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #1e40af;
    color: white;
    font-size: 11px;
    font-weight: bold;
    cursor: help;
    margin-left: auto;
    position: relative;
}

.tooltip:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 25px;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: normal;
    white-space: nowrap;
    max-width: 200px;
    white-space: normal;
    width: max-content;
    z-index: 1001;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.tooltip:hover::before {
    content: '';
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1f2937;
    z-index: 1001;
}

input, textarea, select {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
    font-family: inherit;
}

.select-wrapper {
    position: relative;
}

.select-wrapper select {
    appearance: none;
    padding-right: 45px;
    cursor: pointer;
}

.select-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    pointer-events: none;
    transition: color 0.3s ease;
}

.select-wrapper:hover .select-icon {
    color: #1e40af;
}

.input-wrapper {
    position: relative;
}

.input-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: #64748b;
    font-weight: 600;
    z-index: 1;
}

.budget-input {
    padding-left: 35px;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #1e40af;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.1);
    transform: translateY(-1px);
}

input:hover, select:hover {
    border-color: #d1d5db;
}

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

.form-actions {
    padding: 20px 30px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 16px;
    justify-content: flex-end;
    background: #f9fafb;
    border-radius: 0 0 16px 16px;
}

.form-actions .btn {
    min-width: 120px;
    padding: 12px 24px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.form-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.warning {
    color: #dc2626;
    font-size: 14px;
    font-style: italic;
}

/* Notification styles */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 2000;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    animation: slideIn 0.3s ease-out;
}

.notification.success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.notification.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.notification.info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Form validation styles */
.form-group input:invalid,
.form-group select:invalid {
    border-color: #ef4444;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.1);
}

.form-group input:valid,
.form-group select:valid {
    border-color: #10b981;
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.1);
}

.form-group small {
    color: #666;
    font-size: 12px;
    margin-top: 4px;
    display: block;
}

/* Enhance form styling */
.form-row {
    display: flex;
    gap: 20px;
}

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

/* Disabled button state */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #475569;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .view-toggle {
        order: -1;
        align-self: center;
        margin-bottom: 10px;
    }
    
    .search-container {
        margin-left: 0;
    }
    
    .search-input {
        width: 100%;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
    }
    
    .projects-list .project-list-info {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .project-list-meta {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .project-list-actions {
        margin-top: 10px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 20px;
    }
    
    .form-actions {
        flex-direction: column-reverse;
    }
}

/* Success Animation */
@keyframes success {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.success-animation {
    animation: success 0.3s ease-in-out;
}

/* Disabled field styling for locked AFT field */
select:disabled {
    background-color: #f5f5f5 !important;
    color: #9ca3af !important;
    cursor: not-allowed !important;
    border-color: #d1d5db !important;
    opacity: 0.7;
}

select:disabled + .select-icon {
    color: #d1d5db !important;
}

.select-wrapper:has(select:disabled):hover .select-icon {
    color: #d1d5db !important;
}

/* Tooltip styling for disabled AFT field */
select:disabled:hover {
    border-color: #d1d5db !important;
    transform: none !important;
    box-shadow: none !important;
}