/* Import fonts */
@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:wght@400;500;600&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&display=swap');

body {
    font-family: 'Manrope', sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background-color: #ffffff;
}

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

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 16px 0;
    margin-bottom: 40px;
}

.header-left {
    font-size: 24px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.submit-button {
    padding: 8px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: none;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Manrope', sans-serif;
}

.theme-button {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    background: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-family: 'Manrope', sans-serif;
}

.submit-button:hover,
.theme-button:hover {
    border-color: #1a1a1a;
}

.title-section {
    flex-grow: 1;
    padding-right: 40px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

h1 {
    font-family: 'Crimson Pro', serif;
    color: #1a1a1a;
    margin: 0;
    font-weight: 600;
    font-size: 2.4em;
    line-height: 1.1;
}

.subtitle {
    color: #657786;
    margin: 0;
    font-size: 0.95em;
    line-height: 1.4;
    font-family: 'Manrope', sans-serif;
}

.filter-section {
    min-width: 220px;
    position: relative;
    align-self: flex-end;
    margin-bottom: 2px;
    margin-top: 24px;
}

#category-filter {
    width: 100%;
    height: 44px;
    padding: 0 35px 0 15px;
    border: 1px solid #e1e8ed;
    border-radius: 4px;
    font-size: 0.9em;
    background-color: white;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    font-family: 'Manrope', sans-serif;
    font-weight: 400;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px;
}

.startups-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    padding: 20px 0;
    width: 100%;
}

.startup-card {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
}

.startup-card-link {
    text-decoration: none;
    color: inherit;
    height: 100%;
    display: block;
}

.startup-name {
    font-size: 18px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 8px 0;
}

.startup-description {
    font-size: 14px;
    color: #6B7280;
    margin: 0;
    line-height: 1.5;
}

.founders {
    font-size: 14px;
    color: #6B7280;
    margin: 16px 0;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: auto;
    color: #94A3B8;
    font-size: 13px;
}

.tag {
    background: none;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
    white-space: nowrap;
}

.tag:not(:last-child)::after {
    content: "•";
    margin: 0 8px;
}

.footer {
    margin-top: 10px;
    padding-top: 15px;
    border-top: 1px solid #e1e8ed;
    color: #657786;
    font-size: 0.9em;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer p {
    margin: 0;
}

.footer a {
    color: #657786;
    text-decoration: none;
    transition: color 0.2s;
}

.footer a:hover {
    color: #1a1a1a;
}

/* Dark mode styles */
.dark {
    background-color: #1a1a1a;
    color: #fff;
}

.dark h1 {
    color: #fff;
}

.dark .startup-card {
    background: #1F2937;
    border-color: #374151;
}

.dark .startup-name {
    color: #F9FAFB;
}

.dark .startup-description,
.dark .founders {
    color: #D1D5DB;
}

.dark .tag {
    background: #374151;
    color: #F3F4F6;
}

.dark .submit-button,
.dark .theme-button {
    background-color: #2d2d2d;
    border-color: #404040;
    color: #fff;
}

.dark .submit-button:hover,
.dark .theme-button:hover {
    border-color: #fff;
}

.dark #category-filter {
    background-color: #2d2d2d;
    border-color: #404040;
    color: #fff;
}

.dark .footer {
    border-color: #404040;
    color: #a0aec0;
}

.dark .subtitle {
    color: #a0aec0;
}

.dark .footer a:hover {
    color: #fff;
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
    }

    .title-section {
        padding-right: 0;
    }

    .filter-section {
        width: 100%;
        margin-left: 0;
        margin-top: 20px;
    }
    
    .startups-grid {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 30px 15px 15px;
    }
    
    .footer {
        margin-top: 10px;
        padding-top: 12px;
    }

    .tags {
        margin-top: 12px;
    }
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: flex-start;
    z-index: 1000;
    padding: 40px 20px;
    overflow-y: auto;
}

.modal-content {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    margin: auto;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.submit-form {
    padding: 32px;
    margin: 0;
}

.submit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.submit-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #111827;
    margin: 0;
}

.close-button {
    background: none;
    border: none;
    font-size: 24px;
    color: #6B7280;
    cursor: pointer;
    padding: 4px;
}

/* Form layout */
.form-row {
    display: flex;
    gap: 24px;
    margin-bottom: 24px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.input-group {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.input-group.full-width {
    width: 100%;
}

.input-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

.input-group input,
.input-group textarea,
.dropdown-button,
.funding-options {
    margin-top: 6px;
}

.input-group input,
.input-group textarea {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    padding: 8px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    font-size: 14px;
    line-height: 20px;
    color: #111827;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    margin: 0;
}

/* Funding options */
.funding-options {
    display: flex;
    gap: 12px;
    width: 100%;
    margin-top: 0;
    height: 42px;
}

.funding-option {
    flex: 1;
    height: 42px;
    padding: 0 16px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    background: white;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.funding-option:hover {
    border-color: #2563EB;
    background: #F8FAFC;
}

.funding-option.selected {
    border-color: #2563EB;
    background: #EFF6FF;
    color: #2563EB;
}

/* Description textarea */
#description {
    height: 100px;
    line-height: 1.5;
    padding: 12px;
    resize: none;
    min-height: 100px;
}

/* Categories */
.category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    width: 100%;
    margin-top: 4px;
}

.category-option {
    height: 40px;
    padding: 0 16px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    background: white;
    color: #374151;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.category-option.selected {
    border-color: #2563EB;
    background: #EFF6FF;
    color: #2563EB;
}

/* Form actions */
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
    padding-top: 0;
    border-top: none;
}

.btn-primary,
.btn-secondary {
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
}

.btn-primary {
    background: #2563EB;
    color: white;
    border: none;
}

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

.btn-secondary {
    background: white;
    color: #374151;
    border: 1px solid #D1D5DB;
}

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

/* Dark mode */
.dark .modal-content {
    background: #1F2937;
}

.dark .submit-header h2 {
    color: #F9FAFB;
}

.dark .input-group label {
    color: #9CA3AF;
}

.dark .input-group input,
.dark .input-group textarea,
.dark .funding-option,
.dark .category-option {
    background: #111827;
    border-color: #374151;
    color: #F9FAFB;
    box-shadow: none;
}

.dark .funding-option.selected,
.dark .category-option.selected {
    background: #1F2937;
    border-color: #3B82F6;
    color: #3B82F6;
}

/* Responsive */
@media (max-width: 640px) {
    .modal-content {
        width: 100%;
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
    }

    .form-container {
        grid-template-columns: 1fr;
    }

    .submit-form {
        padding: 16px;
    }
}

/* Ensure proper spacing between sections */
.form-row + .form-row {
    margin-top: 0;
}

/* Fix alignment of funding options with input fields */
.funding-options {
    display: flex;
    gap: 12px;
    width: 100%;
    margin-top: 0;
    height: 42px;
}

.funding-option {
    flex: 1;
    height: 42px;
    padding: 0 16px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    background: white;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Ensure consistent input field height */
.input-group input,
.input-group textarea {
    height: 42px;
    padding: 0 12px;
    line-height: 42px;
    box-sizing: border-box;
}

/* Adjust textarea height separately */
#description {
    height: 100px;
    line-height: 1.5;
    padding: 12px;
    resize: none;
    min-height: 100px;
}

/* Remove spinner arrows from number input */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield; /* Firefox */
    appearance: textfield;
}

/* Ensure consistent styling with other inputs */
#yearFounded {
    padding: 0 12px;
    text-align: left;
}

/* Category select styles */
.category-select {
    width: 100%;
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    color: #374151;
    cursor: pointer;
}

.category-select option {
    padding: 8px 12px;
    cursor: pointer;
}

.category-select option:checked {
    background: #EFF6FF;
    color: #2563EB;
}

/* Dark mode */
.dark .category-select {
    background: #111827;
    border-color: #374151;
    color: #F9FAFB;
}

.dark .category-select option {
    background: #111827;
}

.dark .category-select option:checked {
    background: #1F2937;
    color: #3B82F6;
}

/* Category checkboxes styles */
.categories-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 12px;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    background: #fff;
}

.category-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.category-checkbox:hover {
    border-color: #2563EB;
    background: #F8FAFC;
}

.category-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

.category-checkbox span {
    font-size: 14px;
    color: #374151;
}

.category-checkbox input[type="checkbox"]:checked + span {
    color: #2563EB;
    font-weight: 500;
}

/* Dark mode */
.dark .categories-container {
    background: #111827;
    border-color: #374151;
}

.dark .category-checkbox {
    border-color: #374151;
}

.dark .category-checkbox:hover {
    background: #1F2937;
    border-color: #3B82F6;
}

.dark .category-checkbox span {
    color: #F9FAFB;
}

.dark .category-checkbox input[type="checkbox"]:checked + span {
    color: #3B82F6;
}

@media (max-width: 640px) {
    .categories-container {
        grid-template-columns: 1fr;
    }
}

/* Dropdown styles in modal */
.dropdown-container {
    position: relative;
    width: 100%;
    margin-top: 6px;
}

.dropdown-button {
    width: 100%;
    height: 42px;
    padding: 0 12px;
    background: white;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-size: 14px;
    color: #374151;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dropdown-arrow {
    font-size: 12px;
    color: #6B7280;
    transition: transform 0.2s;
}

.dropdown-content {
    display: none;
    position: absolute;
    bottom: calc(100% + 4px);
    left: 0;
    width: 100%;
    max-height: 240px;
    background: white;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1100;
    overflow-y: auto;
}

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

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid #F3F4F6;
}

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

.dropdown-item:hover {
    background-color: #F3F4F6;
}

.dropdown-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    margin-right: 10px;
    cursor: pointer;
    accent-color: #2563EB;
}

.dropdown-item span {
    font-size: 14px;
    color: #374151;
    user-select: none;
}

/* Scrollbar styles for dropdown */
.dropdown-content::-webkit-scrollbar {
    width: 8px;
}

.dropdown-content::-webkit-scrollbar-track {
    background: #F3F4F6;
    border-radius: 0 8px 8px 0;
}

.dropdown-content::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 4px;
}

.dropdown-content::-webkit-scrollbar-thumb:hover {
    background: #9CA3AF;
}

/* Dark mode styles */
.dark .dropdown-button {
    background: #111827;
    border-color: #374151;
    color: #F9FAFB;
}

.dark .dropdown-content {
    background: #111827;
    border-color: #374151;
}

.dark .dropdown-item {
    border-bottom-color: #374151;
}

.dark .dropdown-item:hover {
    background-color: #1F2937;
}

.dark .dropdown-item span {
    color: #F9FAFB;
}

.dark .dropdown-content::-webkit-scrollbar-track {
    background: #1F2937;
}

.dark .dropdown-content::-webkit-scrollbar-thumb {
    background: #4B5563;
}

.dark .dropdown-content::-webkit-scrollbar-thumb:hover {
    background: #6B7280;
}

/* Animation for dropdown arrow */
.dropdown-content.show + .dropdown-button .dropdown-arrow {
    transform: rotate(0deg);
}

/* Ensure dropdown is above other elements */
.modal-content {
    position: relative;
}

.dropdown-container {
    position: relative;
    z-index: 10;
}

/* Dropdown positioning */
.dropdown-container {
    position: relative;
    width: 100%;
}

.dropdown-content {
    display: none;  /* Initial state is hidden */
    position: absolute;
    bottom: calc(100% + 4px);  /* Position above the button instead of below */
    left: 0;
    width: 100%;
    max-height: 240px;
    background: white;
    border: 1px solid #D1D5DB;
    border-radius: 8px;
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.1);  /* Shadow adjusted for upward display */
    z-index: 1100;
    overflow-y: auto;
}

/* Adjust arrow for upward dropdown */
.dropdown-arrow {
    transform: rotate(180deg);  /* Point upward by default */
}

.dropdown-content.show + .dropdown-button .dropdown-arrow {
    transform: rotate(0deg);  /* Point downward when open */
}

/* Ensure dropdown stays within modal */
.form-row:last-child {
    margin-bottom: 0;
    padding-top: 240px;  /* Add space above for the dropdown */
    margin-top: -220px;  /* Pull the whole row up to compensate */
}

/* Ensure no extra space before form actions */
.form-row:last-child {
    margin-bottom: 0;
    padding-top: 0;  /* Remove any padding */
    margin-top: 0;   /* Remove any margin */
}

/* Animated icons styles */
.animated-icons {
    display: inline-block;
    position: relative;
    width: 24px;
    height: 24px;
}

.icon {
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    animation: cycleIcons 10s infinite;
    font-size: 24px;
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
}

.icon:nth-child(1) { animation-delay: 0s; }
.icon:nth-child(2) { animation-delay: 2s; }
.icon:nth-child(3) { animation-delay: 4s; }
.icon:nth-child(4) { animation-delay: 6s; }
.icon:nth-child(5) { animation-delay: 8s; }

@keyframes cycleIcons {
    0%, 16% { opacity: 0; transform: translateY(10px); }
    20%, 36% { opacity: 1; transform: translateY(0); }
    40%, 100% { opacity: 0; transform: translateY(-10px); }
}

/* Title hover effect */
.title-link {
    text-decoration: none;
    color: inherit;
    position: relative;
    display: inline-block;
    height: 1.1em;  /* Fixed height to prevent jumping */
    line-height: 1.1;  /* Match the height */
}

.title-link > span:not(.hover-text) {
    display: inline-block;
    opacity: 1;
    transform: translateY(0);
    transition: all 0.5s ease;
    position: relative;
}

.title-link .hover-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    opacity: 0;
    transform: translateY(8px);
    transition: all 0.5s ease;
    white-space: nowrap;
}

.title-link:hover > span:not(.hover-text) {
    opacity: 0;
    transform: translateY(-8px);
}

.title-link:hover .hover-text {
    opacity: 1;
    transform: translateY(0);
}

/* Ensure base text is also in one line */
.title-section h1 {
    white-space: nowrap;
    margin: 0;
    line-height: 1.1;
}

/* Clickable card styles */
.startup-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
    transition: transform 0.2s ease;
}

.startup-card-link:hover {
    transform: translateY(-2px);
}

.startup-card-link .startup-card {
    height: 100%;
}

/* Ensure Twitter handle link still works inside clickable card */
.startup-card-link .startup-name a {
    position: relative;
    z-index: 2;
}

/* Hover effect */
.startup-card-link:hover {
    transform: translateY(-2px);
}

/* Dark mode adjustment */
.dark .tags {
    color: #94A3B8;
}

/* Ensure grid maintains structure when filtering */
.startup-card[style*="display: none"] {
    display: none !important;
    grid-column: unset;
}

.startup-card[style*="display: flex"] {
    display: flex !important;
}

/* Fix grid layout */
.startups-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);  /* Fixed 3 columns */
    gap: 24px;
    padding: 20px 0;
    width: 100%;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .startups-grid {
        grid-template-columns: repeat(2, 1fr);  /* 2 columns on medium screens */
    }
}

@media (max-width: 768px) {
    .startups-grid {
        grid-template-columns: 1fr;  /* 1 column on mobile */
    }
}

/* Fix card display */
.startup-card {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
}

/* Ensure cards maintain structure when filtered */
.startup-card[style*="display: none"] {
    display: none !important;
    grid-column: unset;
}

.startup-card[style*="display: flex"] {
    display: flex !important;
}

.subtitle a {
    color: #657786;
    text-decoration: none;
    transition: color 0.2s;
}

.subtitle a:hover {
    color: #1a1a1a;
}

/* Dark mode */
.dark .subtitle a:hover {
    color: #fff;
}