* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    min-height: 100vh;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    height: 192px;
    margin-right: 1rem;
}

h1 {
    font-size: 2rem;
    font-weight: 300;
}

#auth-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.welcome-section {
    padding: 4rem 2rem;
    text-align: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: block;
}

.welcome-section h2 {
    font-size: 2rem;
    color: #495057;
    margin-bottom: 1rem;
    font-weight: 300;
}

.welcome-section p {
    font-size: 1.1rem;
    color: #6c757d;
    max-width: 600px;
    margin: 0 auto;
}

#app-content {
    display: none;
}

.login-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.3s;
}

.login-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.user-info {
    display: none;
    color: white;
    font-size: 0.9rem;
}

#app-content {
    padding: 2rem;
}

.tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 2rem;
}

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

.tab-button:hover {
    color: #333;
    background: #f8f9fa;
}

.tab-button.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.tab-content {
    display: none;
}

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

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.tab-header h2 {
    color: #333;
    font-size: 1.5rem;
    font-weight: 400;
}

.btn-primary {
    background: #667eea;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #5a6fd8;
}

.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

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

.applications-grid {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.grid-header {
    display: grid;
    grid-template-columns: 150px 1fr 200px 200px;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
    border-bottom: 1px solid #dee2e6;
}

.application-row {
    display: grid;
    grid-template-columns: 150px 1fr 200px 200px;
    gap: 1rem;
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
    cursor: pointer;
    transition: background 0.2s;
}

.application-row:hover {
    background: #f8f9fa;
}

.clickable-cell {
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 3px;
    transition: background-color 0.2s ease;
}

.clickable-cell:hover {
    background-color: #e3f2fd;
    color: #1976d2;
}

.copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    margin-left: 0.5rem;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.copy-btn:hover {
    opacity: 1;
}

.field-display-with-copy {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.field-display-with-copy .field-display {
    flex: 1;
}

.application-row:last-child {
    border-bottom: none;
}

#api-result {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 4px;
    font-family: monospace;
    white-space: pre-wrap;
}

@media (max-width: 768px) {
    header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .grid-header,
    .application-row {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .tab-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
}
/* Application Detail Page Styles */
.breadcrumb {
    padding: 1rem 2rem;
    background: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    font-size: 0.9rem;
}

.breadcrumb-link {
    color: #007bff;
    text-decoration: none;
}

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

.breadcrumb-separator {
    margin: 0 0.5rem;
    color: #6c757d;
}

.detail-container {
    padding: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

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

.detail-header h1 {
    margin: 0;
    color: #333;
}

.detail-form {
    display: flex;
    flex-direction: column;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
    max-width: 100%;
}

.field-row:last-child {
    border-bottom: none;
}

.field-row label {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
    text-align: left;
}

.field-value {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.field-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.field-group label {
    font-weight: 600;
    color: #495057;
    font-size: 0.9rem;
}

.field-display {
    padding: 0.1rem;
    border-radius: 4px;
    min-height: 1.2rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.field-display[data-field]:hover {
    background: #e9ecef;
    border-color: #007bff;
}

.metadata-section {
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

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

.metadata-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.metadata-field label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metadata-field span {
    font-size: 0.9rem;
    color: #495057;
}

.field-edit {
    padding: 0.75rem;
    border: 2px solid #007bff;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
}

.field-edit:focus {
    border-color: #0056b3;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

textarea.field-edit {
    min-height: 100px;
    resize: vertical;
}

#app_id-display {
    background: #e9ecef;
    cursor: default;
    font-weight: 600;
    color: #495057;
}

#app_id-display:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.contacts-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.contact-row {
    display: grid;
    grid-template-columns: 1fr 2fr 2fr 1fr;
    gap: 1rem;
    padding: 1rem;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.contact-row:hover {
    background: #f8f9fa;
    border-color: #007bff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Contact Selector Styles */
.contact-selector {
    position: relative;
    display: none;
}

.contact-selector.active {
    display: block !important;
}

.contact-search {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #007bff;
    border-radius: 4px;
    font-size: 1rem;
    outline: none;
}

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

.contact-selector.open .contact-dropdown {
    display: block !important;
}

.contact-option {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
}

.contact-option:hover {
    background: #f8f9fa;
}

.contact-option:last-child {
    border-bottom: none;
}

.contact-option-name {
    font-weight: 600;
    color: #333;
}

.contact-option-details {
    font-size: 0.9rem;
    color: #6c757d;
}
/* History container */
.history-container {
    margin: 0;
    padding: 2rem;
}

/* Applications entries */
.applications-entries {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.application-entry {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 16px;
    background: #f9f9f9;
}

.application-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.contact-role {
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.application-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.application-details > div {
    font-size: 14px;
}

/* History entries */
.history-entries {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.history-entry {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 16px;
    background: #f9f9f9;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #eee;
}

.history-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.history-details > div {
    font-size: 14px;
}
