* {
    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, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 900px;
    margin: 0 auto;
}

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

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

header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

.card {
    background: white;
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 24px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.card h2 {
    color: #667eea;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s;
}

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

.location-results {
    position: relative;
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-top: 8px;
    display: none;
}

.location-results:not(:empty) {
    display: block;
}

.location-item {
    padding: 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.location-item:hover {
    background-color: #f8f9ff;
}

.location-item:last-child {
    border-bottom: none;
}

.loading-small {
    padding: 12px;
    text-align: center;
    color: #999;
}

.no-results, .error {
    padding: 12px;
    text-align: center;
    color: #999;
}

.error {
    color: #e74c3c;
}

.selected-location {
    margin-top: 12px;
}

.selected-info {
    background: #f8f9ff;
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.btn-primary {
    width: 40%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

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

.loading {
    text-align: center;
    color: white;
    padding: 40px;
}

.spinner {
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    background: #f8f9ff;
    padding: 20px;
    border-radius: 8px;
}

.info-grid div {
    padding: 8px;
}

.table-container {
    overflow-x: auto;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #f8f9ff;
}

th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #667eea;
    border-bottom: 2px solid #667eea;
}

td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
}

tbody tr:hover {
    background-color: #f8f9ff;
}

.angles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.angle-card {
    background: #f8f9ff;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border: 2px solid #e8ecff;
}

.angle-card h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1rem;
}

.angle-card p {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

/* Profile Management */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h2, .section-header h3 {
    margin: 0;
}

.profiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.profile-card {
    background: #f8f9ff;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #e8ecff;
    transition: transform 0.2s, box-shadow 0.2s;
}

.profile-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.profile-card h3 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 1.2rem;
}

.profile-card p {
    margin: 5px 0;
    color: #666;
}

.location-small {
    font-size: 0.9rem;
    color: #999;
}

.profile-actions {
    margin-top: 15px;
    display: flex;
    gap: 8px;
}

.btn-secondary {
    background: #5d63b7;
    color: white;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
}

.btn-small {
    padding: 8px 12px;
    font-size: 0.9rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.btn-small.btn-danger {
    background: linear-gradient(135deg, #e74c3c 0%, #d433da 100%);
    color: white;
    font-weight: 600;
}

.btn-small.btn-secondary {
    background: linear-gradient(135deg, #764ba2 0%, #c245de 100%);
    color: white;
}

/* Keyword active state - higher specificity to override btn-secondary */
.btn-small.btn-secondary.keyword-active {
    background: #8f1875 !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
    transform: scale(1.05);
}

.empty-state {
    text-align: center;
    color: #999;
    padding: 40px;
    font-style: italic;
}

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

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

/* Blurbs */
.blurb-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.blurb-template {
    background: #f8f9ff;
    padding: 20px;
    border-radius: 8px;
    border: 2px solid #e8ecff;
    cursor: pointer;
    transition: all 0.2s;
}

.blurb-template:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    border-color: #667eea;
}

.blurb-text {
    font-size: 1.1rem;
    color: #333;
    margin-bottom: 12px;
    line-height: 1.6;
}

.blurb-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #999;
}

.blurb-category {
    background: #667eea;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
}

.blurb-author {
    font-style: italic;
}

.custom-blurb-form {
    background: #f8f9ff;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.custom-blurb-form h4 {
    color: #667eea;
    margin-bottom: 16px;
}

.replacement-group {
    background: white;
    padding: 16px;
    border-radius: 8px;
    margin: 12px 0;
    border: 1px solid #e0e0e0;
}

.replacement-group label strong {
    color: #764ba2;
    font-family: 'Courier New', monospace;
}

.replacement-group label small {
    display: block;
    color: #666;
    font-size: 0.85rem;
    margin-top: 4px;
}

#replacementFields {
    margin: 20px 0;
}

textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
}

.generated-blurb {
    background: white;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    margin-bottom: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.blurb-result {
    font-size: 1rem;
    color: #333;
    margin-bottom: 10px;
}

.blurb-original {
    color: #999;
    font-size: 0.9rem;
    margin: 10px 0;
}

#generatedBlurbs {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 2px solid #e8ecff;
}

#generatedBlurbs h3 {
    color: #667eea;
    margin-bottom: 20px;
}
/* Delete button on blurb templates */
.btn-delete {
    background: linear-gradient(135deg, #ff4781 0%, #d433da 100%);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.3s;
}

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

.blurb-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    margin: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 2px solid #f0f0f0;
}

.modal-header h3 {
    color: #667eea;
    margin: 0;
}

.close-modal {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-body {
    padding: 30px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

/* Bin modal */
.bin-item {
    background: #f8f9ff;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    border-left: 4px solid #ff4757;
}

.bin-item .blurb-text {
    font-size: 1rem;
    color: #333;
    margin-bottom: 10px;
}

.bin-actions {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.btn-danger {
    background: #ff4757 !important;
}

.btn-danger:hover {
    background: #ee2f3d !important;
}

.empty-message {
    text-align: center;
    color: #999;
    padding: 40px;
    font-size: 1.1rem;
}

/* Profile labels and filters */
.blurb-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.profile-label {
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-edit {
    background: #764ba2;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.3s;
}

.btn-submit {
    background: #1b812e;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: background 0.3s;
}

.btn-edit:hover {
    background: #5d3a82;
}

.btn-copy {
    background: #667eea;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.3s;
}

.btn-copy:hover {
    background: #5568d3;
}

.profile-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9ff;
    border-radius: 8px;
}

.filter-btn {
    background: white;
    color: #333;
    border: 2px solid #e0e0e0;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.filter-btn:hover {
    border-color: #667eea;
}

.filter-exclude {
    background: #ffe5e5;
    border-color: #ff4757;
    color: #ff4757;
}

.filter-include {
    background: #e5f7e5;
    border-color: #2ecc71;
    color: #2ecc71;
}

.section-header > div {
    display: flex;
    gap: 10px;
}
.filter-message {
    text-align: center;
    color: #999;
    padding: 20px;
    font-style: italic;
}

.syn-pair-select {
    background: white;
    color: #333;
    border: 2px solid #e0e0e0;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23999'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 30px;
    transition: border-color 0.2s;
}

.syn-pair-select:hover,
.syn-pair-select:focus {
    border-color: #667eea;
}

.syn-pair-sep {
    color: #999;
    font-size: 0.9rem;
    user-select: none;
}
/* Chart View Styles */
.chart-wheel {
    margin: 20px auto;
    display: flex;
    justify-content: center;
    min-height: 600px;
}

.chart-display {
    margin-top: 20px;
}

.chart-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.chart-table th,
.chart-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.chart-table thead {
    background: #f8f9fa;
}

.chart-table th {
    font-weight: 600;
    color: #667eea;
}

.chart-table tbody tr:hover {
    background: #f8f9fa;
}

.profile-selector {
    padding: 8px 16px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.profile-selector:hover,
.profile-selector:focus {
    border-color: #667eea;
    outline: none;
}

/* Template filter styles */
.blurb-template-clickable {
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 10px;
    border: 1px solid #3b53bc;
}

.blurb-template-clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.blurb-template-clickable.filter-exclude {
    opacity: 0.5;
    background: #ffe5e5;
}

.blurb-template-clickable.filter-include {
    border: 3px solid #2ecc71;
    background: #e5f7e5;
}

.filter-indicator {
    display: inline-block;
    margin-left: 10px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Synastry Selection States */
.synastry-selected-1 {
    border: 3px solid #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.synastry-selected-2 {
    border: 3px solid #f5576c !important;
    box-shadow: 0 0 0 3px rgba(245, 87, 108, 0.2);
}

.profile-card {
    cursor: pointer;
    transition: all 0.2s ease;
}

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

@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }

    .card {
        padding: 20px;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .blurb-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        margin: 12px 0;
    }

    .blurb-template,
    .blurb-template-clickable {
        padding: 12px 14px;
    }

    .blurb-text {
        font-size: 0.7rem;
        margin-bottom: 8px;
    }

    .blurb-meta {
        font-size: 0.78rem;
    }
    
    [class*="btn-"], .filter-btn, .syn-pair-select {
        font-size: 0.78rem;
        padding: 6px 10px;
    }
}