/* Core Variables */
:root {
    --bg-primary: #000000;
    --bg-secondary: #1e1e1e;
    --accent-color: #ff3366;
    --accent-hover: #ff4d7d;
    --text-primary: #f5f5f5;
    --text-secondary: #b0b0b0;
    --border-color: #333333;
    --container-max-width: 600px;
    --error-color: #ff3366;
    --success-color: #2ecc71;
    --draft-bg: #773300;
    --draft-text: #ffcc99;
    --publish-bg:rgb(5, 122, 13);
    --publish-text: #ffcc99;
}

/* General Styles */
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.5;
}

.main-container {
    max-width: var(--container-max-width, 600px);
    margin: 0 auto;
    padding: 0;
}

/* Main content */
.app-content {
    flex: 1;
    padding: 0;
    overflow-y: auto;
}

.content-container {
    padding: 16px;
    margin-top: 15px;
}

.page-title {
    margin-top: 15px;
    margin-bottom: 20px;
    text-align: left;
}

/* Alerts */
.alert {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 8px;
    font-size: 14px;
}

.alert svg {
    margin-right: 10px;
    flex-shrink: 0;
}

.alert-danger {
    background-color: rgba(255, 51, 102, 0.1);
    color: var(--error-color);
    border: 1px solid rgba(255, 51, 102, 0.2);
}

.alert-success {
    background-color: rgba(46, 204, 113, 0.1);
    color: var(--success-color);
    border: 1px solid rgba(46, 204, 113, 0.2);
}

/* Form Sections */
.form-section {
    margin-bottom: 24px;
    padding: 5px;
    background-color: var(--bg-primary);
    border-radius: 8px;
    border: 0px solid orange;
}


.section-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 16px 0;
}

/* Image Upload */
.image-upload-container {
    position: relative;
    width: 100%;
    margin-bottom: 20px;
    overflow: hidden;
    border-radius: 8px;
}

.upload-preview {
    position: relative;
    width: 100%;
    padding-top: 100%; /* Square aspect ratio */
    overflow: hidden;
    background-color: var(--bg-secondary);
}

.upload-preview img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: all 0.3s ease;
}

.upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.6);
    color: var(--text-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
}

.upload-overlay svg {
    margin-bottom: 8px;
}

.upload-preview:hover .upload-overlay {
    opacity: 1;
}

.hidden-input {
    position: absolute;
    width: 0.1px;
    height: 0.1px;
    opacity: 0;
    overflow: hidden;
    z-index: -1;
}

/* Form Controls */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

.form-control:focus {
    border-color: var(--accent-color);
    outline: none;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

.character-counter {
    display: flex;
    justify-content: flex-end;
    margin-top: 0px;
    font-size: 12px;
    color: var(--text-secondary);
}

.character-count-warning {
    color: var(--accent-color);
    font-weight: bold;
}

/* Add a subtle animation when approaching the limit */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

.character-count-warning {
    animation: pulse 1s infinite;
}

.form-row {
    display: flex;
    margin: 0 -8px;
}

.half {
    flex: 0 0 50%;
    padding: 0 8px;
}

/* Ensure select elements have the same box-sizing as other inputs */
select.form-control {
    box-sizing: border-box;
    width: 100%;

}

/* Fix for the specific duration dropdown */
#duration {
    width: 100%;
    max-width: 100%;

    text-overflow: ellipsis;
    white-space: nowrap;
    overflow: hidden;
}

/* Make sure half fields respect their container width */
.form-row .half {
    flex: 0 0 calc(50% - 10px); /* Adjust for the padding in form-row */
    max-width: calc(50% - 10px);
    box-sizing: border-box;
}

/* Input with icons */
.input-with-icon {
    position: relative;
}

.input-prefix {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 16px;
}

.form-control.with-prefix {
    padding-left: 32px;
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    z-index: 1;
    pointer-events: none;
}

.search-input {
    padding-left: 40px;
    margin-bottom: 8px;
}

/* Location select */
.location-autocomplete-wrapper {
  position: relative;
}

.location-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  margin-top: 4px;
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.location-suggestion-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

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

.location-suggestion-item:hover {
  background-color: var(--bg-secondary);
}

.suggestion-city {
  font-weight: 500;
}

.suggestion-state {
  color: var(--text-secondary);
}

.no-suggestions {
  padding: 12px 16px;
  color: var(--text-secondary);
  font-style: italic;
}

#location_search.error {
  border-color: var(--error-color);
}

#location_search.location-selected {
  border-color: var(--success-color);
}

.location-error {
  margin-top: 8px;
}

/* Radio Buttons */
.radio-group {
    display: flex;
    flex-direction: row;
    gap: 16px;
    margin-top: 8px;
    width: 100%;
}

.radio-item {
    flex: 1;
}

.radio-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.radio-circle {
    display: inline-block;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--text-secondary);
    position: relative;
    margin-right: 8px;
    flex-shrink: 0;
}

.radio-circle:after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: var(--accent-color);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    transition: transform 0.2s ease;
}

.radio-text {
    font-size: 14px;
    font-weight: 500;
}

.radio-input:checked + .radio-label {
    border-color: var(--accent-color);
    background-color: rgba(255, 51, 102, 0.1);
}

.radio-input:checked + .radio-label .radio-circle {
    border-color: var(--accent-color);
}

.radio-input:checked + .radio-label .radio-circle:after {
    transform: translate(-50%, -50%) scale(1);
}

/* For smaller screens, ensure text doesn't wrap */
@media (max-width: 480px) {
    .radio-text {
        font-size: 13px;
    }
}

/* Add focus styles for accessibility */
.radio-input:focus + .radio-label {
    box-shadow: 0 0 0 2px rgba(255, 51, 102, 0.3);
    outline: none;
}

/* Tag Grid */
.tags-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* Add media query for mobile responsiveness */
@media (max-width: 480px) {
    .tags-grid {
        grid-template-columns: 1fr; /* Change to single column on mobile */
        gap: 8px; /* Slightly reduce gap for better space utilization */
    }
    
    /* Make tag labels more compact on mobile */
    .tag-label {
        padding: 10px 8px; /* Slightly reduce padding */
        font-size: 13px; /* Slightly smaller font */
    }
    
    /* Ensure the icon is visible but not too large */
    .tag-icon {
        margin-right: 6px;
        font-size: 15px;
    }
}

/* For very small devices */
@media (max-width: 350px) {
    .tag-label {
        padding: 8px 6px;
    }
}

.tag-item {
    position: relative;
}

.tag-checkbox {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.tag-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    text-align: center;
    border-radius: 8px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tag-icon {
    margin-right: 8px;
    font-size: 16px;
}

.tag-text {
    font-weight: 500;
}

.tag-checkbox:checked + .tag-label {
    border-color: var(--accent-color);
    background-color: rgba(255, 51, 102, 0.1);
    color: var(--text-primary);
    box-shadow: 0 2px 8px rgba(255, 51, 102, 0.3);
}

.tag-checkbox:focus + .tag-label {
    box-shadow: 0 0 0 2px rgba(255, 51, 102, 0.3);
}

.tag-error {
    margin-bottom: 16px;
}

/* Toggle Switches */
.toggle-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.toggle-info {
    flex: 1;
}

.toggle-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.toggle-description {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    border-radius: 24px;
    transition: .3s;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-primary);
    border-radius: 50%;
    transition: .3s;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--accent-color);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

/* Premium Settings Styling */
.premium-settings {
    margin-top: 16px;
    padding: 16px;
    background-color: rgba(255, 51, 102, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 51, 102, 0.1);
}

.premium-settings .form-text {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Draft Info Section */
.draft-info {
    display: flex;
    align-items: center;
    background-color: var(--draft-bg);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.draft-icon {
    margin-right: 16px;
    color: var(--draft-text);
}

.draft-text h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--draft-text);
}

.draft-text p {
    margin: 0;
    font-size: 14px;
    color: var(--draft-text);
    opacity: 0.8;
}

/* Publish Info Section */
.publish-info {
    display: flex;
    align-items: center;
    background-color: var(--publish-bg);
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.publish-icon {
    margin-right: 16px;
    color: var(--draft-text);
}

.publish-text h4 {
    margin: 0 0 4px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--publish-text);
}

.publish-text p {
    margin: 0;
    font-size: 14px;
    color: var(--publish-text);
    opacity: 0.8;
}

/* Action Buttons */
.form-actions {
    margin-top: 24px;
    margin-bottom: 40px;
}

.btn-primary {
    display: block;
    width: 100%;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    color: white;
    background-color: var(--accent-color);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
}

.btn-create {
    margin-top: 20px;
}

/* Responsive Adjustments */
@media (min-width: 768px) {
    .content-container {
        padding: 24px;
    }
    
    .form-section {
        padding: 20px;
    }
}

/* Add more spacing between header and content */
.app-content {
    padding-top: 24px;
}

/* Add a title to the image upload section */
.image-upload-container::before {
    content: "Upload Preview";
    display: block;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 12px;
}

/* Increase space between upload box and form fields */
.form-section:first-of-type {
    margin-top: 20px;
}

/* Make the upload box more obvious with an icon on default state */
.upload-preview::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4'%3E%3C/path%3E%3Cpolyline points='17 8 12 3 7 8'%3E%3C/polyline%3E%3Cline x1='12' y1='3' x2='12' y2='15'%3E%3C/line%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.7;
    pointer-events: none;
    z-index: 2;
}

/* Add a subtle border and background to make it look more interactive */
.upload-preview {
    border: 2px dashed var(--border-color);
    background-color: rgba(255, 255, 255, 0.05);
}

/* Hide the default icon when an image is selected */
.upload-preview.has-image::after {
    display: none;
}

/* Improve hover state */
.upload-overlay {
    background-color: rgba(0, 0, 0, 0.7);
}

.promotion-option {
    position: relative;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    margin-bottom: 12px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s ease;
}

.promotion-option:hover {
    border-color: var(--accent-color);
    background-color: rgba(255, 51, 102, 0.05);
}

.promotion-option.selected {
    border-color: var(--accent-color);
    background-color: rgba(255, 51, 102, 0.05);
    box-shadow: 0 0 0 2px rgba(255, 51, 102, 0.2);
}

.hidden {
    display: none;
}

/* Promotion Options Styling */

/* Section container */
.promotion-section {
    margin-bottom: 24px;
    padding: 0;
}

.section-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
}

.section-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 20px;
}

/* Options container */
.promotion-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 24px;
}

/* Individual option card */
.promotion-option {
    position: relative;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #1e1e1e;
}

.promotion-option:hover {
    border-color: var(--accent-color);
    background-color: rgba(255, 51, 102, 0.05);
}

.promotion-option.selected {
    border-color: var(--accent-color);
    background-color: rgba(255, 51, 102, 0.1);
    box-shadow: 0 0 0 2px rgba(255, 51, 102, 0.3);
    transition: all 0.2s ease;
}

/* Improve the disabled state styling */
.promotion-option.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    border-color: #444;
}

.promotion-option.disabled .option-title,
.promotion-option.disabled .option-description,
.promotion-option.disabled .option-price {
    color: #777;
}

.promotion-option.disabled:hover {
    border-color: #444;
    background-color: transparent;
}

/* Add a smooth transition for all state changes */
.promotion-option {
    transition: all 0.2s ease;
}

/* Enhance the summary section */
.summary {
    background-color: #1a1a1a;
    border-radius: 12px;
    padding: 16px;
    margin-top: 24px;
    border: 1px solid #333;
    transition: all 0.3s ease;
}

/* Add transitions for smoother updates */
.summary-row,
.summary-total,
.your-balance {
    transition: all 0.3s ease;
}

/* Improve visibility of the promotion cost row */
.promotion-cost {
    background-color: rgba(255, 51, 102, 0.05);
    border-radius: 4px;
    padding: 4px 8px;
    margin: 4px 0;
    transition: all 0.3s ease;
}

/* Animation for showing/hiding the promotion cost */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.promotion-cost:not(.hidden) {
    animation: fadeIn 0.3s ease forwards;
}

/* Enhance the summary labels and values */
.summary-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.summary-value {
    font-weight: 600;
    color: var(--text-primary);
}

.summary-total .summary-value {
    color: var(--accent-color);
}

/* Improve the balance display */
.your-balance {
    background-color: rgba(255, 51, 102, 0.1);
    padding: 10px;
    border-radius: 8px;
    margin-top: 12px;
}

.your-balance .summary-label {
    color: var(--text-primary);
}

.your-balance .summary-value {
    color: var(--accent-color);
    font-weight: 700;
}

/* Mobile optimizations */
@media (max-width: 480px) {
    .promotion-option {
        padding: 12px;
    }
    
    .option-icon {
        width: 40px;
        height: 40px;
    }
    
    .option-title {
        font-size: 15px;
    }
    
    .option-description {
        font-size: 13px;
    }
    
    .summary {
        padding: 12px;
    }
}

/* Promotion section styles */
.promotion-section {
    margin-bottom: 24px;
}

.promotion-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 20px;
}

.promotion-option {
    position: relative;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s ease;
}

.promotion-option:hover {
    border-color: var(--accent-color);
    background-color: rgba(255, 51, 102, 0.05);
}

.promotion-option.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.promotion-radio {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.promotion-label {
    display: flex;
    align-items: center;
    padding: 16px;
    cursor: pointer;
    width: 100%;
}

.option-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 16px;
    flex-shrink: 0;
}

.feature-icon {
    background-color: rgba(255, 184, 0, 0.1);
    color: #ffb800;
}

.boost-icon {
    background-color: rgba(131, 56, 236, 0.1);
    color: #8338ec;
}

/* No Promotion option specific styles */
.no-promotion .option-icon {
    background-color: rgba(128, 128, 128, 0.1);
    color: #757575; /* Neutral gray color for standard option */
}

.option-details {
    flex: 1;
}

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

.option-title {
    font-weight: 600;
    font-size: 16px;
}

.option-price {
    background-color: rgba(255, 51, 102, 0.1);
    color: var(--accent-color);
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.option-description {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Make the selected option stand out */
.promotion-radio:checked + .promotion-label {
    background-color: rgba(255, 51, 102, 0.1);
}

.promotion-radio:checked + .promotion-label .option-title {
    color: var(--accent-color);
}

.promotion-option:has(.promotion-radio:checked) {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 1px var(--accent-color);
}

/* Summary section */
.promotion-summary {
    margin-top: 24px;
    padding: 16px;
    background-color: var(--bg-secondary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.summary-heading {
    font-weight: 600;
    margin-bottom: 12px;
    font-size: 16px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.summary-total {
    display: flex;
    justify-content: space-between;
    border-top: 1px solid var(--border-color);
    margin-top: 8px;
    padding-top: 8px;
    font-weight: 600;
}

.credits-available {
    display: flex;
    justify-content: space-between;
    background-color: rgba(255, 51, 102, 0.1);
    padding: 8px;
    border-radius: 4px;
    margin-top: 12px;
}

.hidden {
    display: none;
}