/**
 * CTC Stock Frontend Styles
 */

/* Base container styles */
.ctc-stock-container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 12px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    box-sizing: border-box;
}

.ctc-stock-title {
    margin-bottom: 16px;
    font-size: 28px;
    font-weight: 600;
}

/* Form section styles */
.ctc-stock-form-section {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    padding: 20px;
    margin-bottom: 24px;
    width: 100%;
    box-sizing: border-box;
}

.ctc-stock-form-section h3 {
    margin-top: 0;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    line-height: 1.3;
}

/* Form layout */
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 15px;
}

.form-field {
    flex: 1 1 250px;
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 15px;
}

.form-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 14px;
    color: #333;
}

.form-field input[type="text"],
.form-field input[type="date"],
.form-field select,
.form-field textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 15px;
    box-sizing: border-box;
    -webkit-appearance: none; /* Remove default styling on iOS */
    appearance: none;
    background-color: #fdfdfd;
    transition: border-color 0.2s, box-shadow 0.2s;
    height: 40px;
}

.form-field textarea {
    height: auto;
    min-height: 120px;
}

.form-field input[type="text"]:focus,
.form-field input[type="date"]:focus,
.form-field select:focus,
.form-field textarea:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
    outline: none;
}

/* Consistent description & help text */
.description,
p.description,
.form-field .description,
.form-field p.description {
    font-size: 13px !important;
    color: #666 !important;
    line-height: 1.4 !important;
    margin-top: 6px !important;
    margin-bottom: 0 !important;
    font-style: normal !important;
    font-weight: normal !important;
}

/* Input with icon container */
.input-with-icon {
    position: relative;
    width: 100%;
}

.input-with-icon input {
    padding-right: 40px;
}

.input-with-icon .enclosure-dropdown-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #555;
    cursor: pointer;
    z-index: 5;
}

/* Button styling */
.ctc-stock-button,
.ctc-stock-submit-button,
.ctc-stock-camera-button,
.ctc-stock-upload-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    height: 40px;
    line-height: 1;
}

.ctc-stock-button,
.ctc-stock-submit-button {
    background: #0073aa;
    color: #fff;
}

.ctc-stock-button:hover,
.ctc-stock-submit-button:hover {
    background: #005f8b;
    color: #fff;
}

.ctc-stock-camera-button,
.ctc-stock-upload-button {
    background: #f7f7f7;
    border-color: #ddd;
    color: #333;
}

.ctc-stock-camera-button:hover,
.ctc-stock-upload-button:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

.ctc-stock-submit-button {
    background-color: #4caf50; /* Green to match second section */
    border-color: #3d8b40;
    color: #fff;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    height: 46px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.ctc-stock-submit-button:hover {
    background-color: #3d8b40;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.ctc-stock-button-green {
    background: #4caf50;
    color: #fff;
}

.ctc-stock-button-green:hover {
    background: #3d8b40;
    color: #fff;
}

/* Photo preview */
.animal-photos-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 15px;
    margin-bottom: 16px;
    min-height: 30px; /* Always provide some visual space for previews */
}

/* jQuery UI Autocomplete styling for frontend */
.ui-autocomplete {
    max-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 999999 !important;
    border: 1px solid #ddd !important;
    background-color: #fff !important;
    box-shadow: 0 2px 5px rgba(0,0,0,0.15) !important;
    padding: 5px 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
}

.ui-menu .ui-menu-item-wrapper {
    padding: 8px 12px !important;
    font-size: 14px !important;
    border-bottom: 1px solid #f5f5f5 !important;
    cursor: pointer !important;
}

.ui-menu .ui-menu-item:last-child .ui-menu-item-wrapper {
    border-bottom: none !important;
}

.ui-menu .ui-menu-item-wrapper.ui-state-active {
    background-color: #0073aa !important;
    color: #fff !important;
    border: none !important;
    margin: 0 !important;
}

/* Required field indicator */
.required {
    color: #d63638;
    font-weight: bold;
}

/* Response message */
.ctc-stock-response {
    padding: 12px 15px;
    margin-bottom: 16px;
    border-radius: 4px;
    font-size: 15px;
}

.ctc-stock-response.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.ctc-stock-response.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Success message styling */
.ctc-stock-success-message {
    text-align: center;
    padding: 10px 0;
}

.ctc-stock-success-message h3 {
    font-size: 24px;
    color: #155724;
    margin-bottom: 15px;
    font-weight: 600;
}

.ctc-stock-success-message p {
    font-size: 16px;
    margin-bottom: 10px;
    line-height: 1.6;
}

.ctc-stock-success-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.ctc-stock-button.secondary {
    background: #f8f9fa;
    color: #333;
    border: 1px solid #ddd;
}

.ctc-stock-button.secondary:hover {
    background: #e9ecef;
    color: #333;
}

/* Loading indicator */
.ctc-stock-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px;
}

.ctc-stock-loading .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Responsive styles */
@media (max-width: 768px) {
    .ctc-stock-container {
        padding: 8px;
        width: 100%;
    }
    
    .form-field {
        flex: 0 0 100%;
    }
    
    .ctc-stock-submit-button {
        width: 100%;
        justify-content: center;
    }
    
    .ctc-stock-photo-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .ctc-stock-camera-button,
    .ctc-stock-upload-button {
        width: 100%;
    }
    
    .ctc-stock-form-section {
        padding: 12px;
    }
    
    /* Adjust mobile input styles */
    .form-field input[type="text"],
    .form-field input[type="date"],
    .form-field select,
    .form-field textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* Date field styling */
.date-input-container {
    position: relative;
    width: 100%;
}

.date-input-container input[type="date"] {
    width: 100%;
    padding-right: 40px; /* Space for icon */
}

.date-input-container .date-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #555;
    pointer-events: none;
    z-index: 1;
    line-height: 1;
    height: 20px;
    width: 20px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Override browser's built-in calendar icon on date inputs */
input[type="date"]::-webkit-calendar-picker-indicator {
    opacity: 0;
    width: 28px;
    height: 28px;
    position: absolute;
    right: 0;
    top: 0;
    cursor: pointer;
}

/* Make sure only one date icon is visible */
.date-input-container .date-icon:nth-child(n+2) {
    display: none;
}

/* Voice input compatibility */
.voice-input-compatible {
    width: 100%;
    min-height: 120px;
    font-size: 15px;
}

/* Photo upload styling */
.ctc-stock-photo-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
}

.ctc-stock-camera-button,
.ctc-stock-upload-button {
    min-width: 180px;
    text-align: center;
    justify-content: center;
    height: 44px;
    display: inline-flex;
    align-items: center;
    font-weight: 500;
}

.ctc-stock-camera-button {
    background-color: #fff;
    color: #9c27b0;
    border: 2px solid #9c27b0;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

.ctc-stock-camera-button:hover {
    background-color: #9c27b0;
    color: #fff;
    border-color: #7B1FA2;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.ctc-stock-upload-button {
    background-color: #fff;
    color: #666;
    border: 2px solid #ddd;
}

.ctc-stock-upload-button:hover {
    background-color: #f5f5f5;
    border-color: #999;
    color: #333;
}

.ctc-stock-camera-button .dashicons,
.ctc-stock-upload-button .dashicons,
.ctc-stock-submit-button .dashicons {
    margin-right: 8px;
    font-size: 18px;
    line-height: 1;
}

/* Form actions */
.ctc-stock-form-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-top: 20px;
    gap: 15px;
}

/* Photo preview items */
.animal-photo-item {
    position: relative;
    width: 100px;
    height: 100px;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    background-color: #f9f9f9;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.animal-photo-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.animal-photo-item .remove-photo {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    text-align: center;
    line-height: 22px;
    font-size: 16px;
    cursor: pointer;
    z-index: 10; /* Ensure it's above the image */
    user-select: none;
}

/* Select dropdown styling */
.form-field select {
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg width="14" height="8" viewBox="0 0 14 8" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M1 1L7 7L13 1" stroke="%23555555" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

/* Microphone tip styling */
.mic-tip {
    display: flex;
    align-items: center;
    margin-top: 8px;
    color: #666;
    font-style: italic;
}

.mic-tip .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    margin-right: 5px;
    color: #007cba;
}

/* Color-coded form sections */
.ctc-stock-form-section:nth-of-type(1) {
    background-color: #f0f7fc; /* Light blue */
    border-left: 3px solid #007cba;
}

.ctc-stock-form-section:nth-of-type(2) {
    background-color: #f7fcf0; /* Light green */
    border-left: 3px solid #4caf50;
}

.ctc-stock-form-section:nth-of-type(3) {
    background-color: #fcf8f0; /* Light orange */
    border-left: 3px solid #ff9800;
}

.ctc-stock-form-section:nth-of-type(4) {
    background-color: #f8f0fc; /* Light purple */
    border-left: 3px solid #9c27b0;
}

/* Adjust section headers to match section colors */
.ctc-stock-form-section:nth-of-type(1) h3 {
    color: #007cba;
}

.ctc-stock-form-section:nth-of-type(2) h3 {
    color: #4caf50;
}

.ctc-stock-form-section:nth-of-type(3) h3 {
    color: #ff9800;
}

.ctc-stock-form-section:nth-of-type(4) h3 {
    color: #9c27b0;
}

/* Override theme heading margins */
.entry-content .ctc-stock-form-section h1, 
.entry-content .ctc-stock-form-section h2, 
.entry-content .ctc-stock-form-section h3, 
.entry-content .ctc-stock-form-section h4, 
.entry-content .ctc-stock-form-section h5, 
.entry-content .ctc-stock-form-section h6 {
    margin: 0 0 16px 0;
}

/* Give our own headings consistent spacing */
.ctc-stock-form-section h3 {
    margin-top: 0;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #eee;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
}

/**
 * Species List Page Styles - Enhanced with images
 */
.ctc-stock-species-list {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 15px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.ctc-stock-species-list-title {
    font-size: 28px;
    font-weight: 700;
    color: #333;
    margin-bottom: 30px;
    text-align: center;
}

.ctc-stock-species-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
}

.ctc-stock-species-card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
    display: flex;
    flex-direction: column;
}

.ctc-stock-species-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
}

.ctc-stock-species-image {
    height: 200px;
    width: 100%;
    position: relative;
    overflow: hidden;
    background-color: #f5f5f5;
}

.ctc-stock-species-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s;
}

.ctc-stock-species-card:hover .ctc-stock-species-image img {
    transform: scale(1.05);
}

.ctc-stock-species-image-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 500;
}

.ctc-stock-no-image {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f0f0f0;
}

.ctc-stock-no-image .dashicons {
    font-size: 50px;
    color: #ccc;
}

.ctc-stock-species-card-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.ctc-stock-species-name {
    font-size: 22px;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 8px;
}

.ctc-stock-species-name a {
    color: #0073aa;
    text-decoration: none;
    transition: color 0.2s;
}

.ctc-stock-species-name a:hover {
    color: #005f8b;
    text-decoration: underline;
}

.ctc-stock-species-scientific-name {
    font-style: italic;
    color: #666;
    margin-bottom: 15px;
    font-size: 15px;
}

.ctc-stock-species-animals-count {
    font-size: 15px;
    color: #555;
    margin-bottom: 20px;
    background: #f5f5f5;
    padding: 6px 12px;
    border-radius: 20px;
    display: inline-block;
}

.ctc-stock-species-view-link {
    display: inline-block;
    padding: 10px 20px;
    background-color: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 15px;
    font-weight: 500;
    transition: background-color 0.2s;
    text-align: center;
    margin-top: auto;
}

.ctc-stock-species-view-link:hover {
    background-color: #005f8b;
    color: #fff;
}

/**
 * Single Species Page Styles
 */
.ctc-stock-species-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 15px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.ctc-stock-species-header {
    margin-bottom: 30px;
    text-align: center;
}

.ctc-stock-species-title {
    font-size: 32px;
    font-weight: 700;
    color: #333;
    margin-top: 0;
    margin-bottom: 10px;
}

.ctc-stock-species-scientific-name {
    font-style: italic;
    color: #666;
    margin-bottom: 20px;
    font-size: 18px;
}

.ctc-stock-species-meta {
    margin-bottom: 20px;
}

.ctc-stock-species-count {
    display: inline-block;
    padding: 5px 10px;
    background-color: #f1f1f1;
    border-radius: 4px;
    font-size: 14px;
    margin-bottom: 15px;
}

.ctc-stock-species-description {
    max-width: 800px;
    margin: 0 auto;
    line-height: 1.6;
    font-size: 16px;
}

.ctc-stock-species-animals-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.ctc-stock-species-animal-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.ctc-stock-species-animal-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.ctc-stock-species-animal-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.ctc-stock-species-animal-card-link:hover {
    text-decoration: none;
    color: inherit;
}

.ctc-stock-species-animal-image {
    height: 200px;
    position: relative;
    overflow: hidden;
}

.ctc-stock-species-animal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ctc-stock-no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f8f8f8;
}

.ctc-stock-no-image .dashicons {
    font-size: 48px;
    color: #ccc;
}

.ctc-stock-species-animal-details {
    padding: 15px;
}

.ctc-stock-species-animal-name {
    font-size: 18px;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 10px;
    color: #0073aa;
}

.ctc-stock-species-animal-card-link:hover .ctc-stock-species-animal-name {
    color: #005f8b;
    text-decoration: underline;
}

.ctc-stock-species-animal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
    font-size: 14px;
}

.ctc-stock-species-animal-meta > span {
    background: #f1f1f1;
    padding: 3px 8px;
    border-radius: 4px;
    color: #555;
}

.ctc-stock-species-animal-view-link {
    display: inline-block;
    padding: 6px 12px;
    background-color: #0073aa;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.ctc-stock-species-animal-view-link:hover {
    background-color: #005f8b;
    color: #fff;
}

.ctc-stock-species-back-link {
    margin-top: 30px;
    text-align: center;
}

.ctc-stock-species-back-link a {
    display: inline-block;
    padding: 8px 16px;
    color: #0073aa;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.ctc-stock-species-back-link a:hover {
    color: #005f8b;
    text-decoration: underline;
}

@media (max-width: 768px) {
    .ctc-stock-species-animals-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }
    
    .ctc-stock-species-title {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .ctc-stock-species-animals-grid {
        grid-template-columns: 1fr;
    }
}

/* Gender selector styling */
.gender-selector {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 10px;
    width: 100%;
}

.gender-selector input[type="radio"] {
    display: none;
}

.gender-icon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 30px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 100px;
    min-height: 120px;
    text-align: center;
    flex: 1;
    max-width: 160px;
}

.gender-icon .dashicons {
    font-size: 42px;
    width: 42px;
    height: 42px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    margin-right: auto;
}

.gender-icon.male {
    color: #0073aa;
    background-color: #e6f3f8;
    border: none;
}

.gender-icon.female {
    color: #d23765;
    background-color: #fce8ef;
    border: none;
}

.gender-icon.unknown {
    color: #555;
    background-color: #f0f0f0;
    border: none;
}

.gender-label {
    font-size: 15px;
    font-weight: 500;
    display: block;
    line-height: 1.4;
    margin-top: auto;
    padding-top: 10px;
    border-top: 2px solid rgba(0,0,0,0.1);
    width: 100%;
    text-align: center;
}

/* Selected state */
input[type="radio"]:checked + .gender-icon.male {
    background: #0073aa;
    color: #fff;
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(0, 115, 170, 0.2);
}

input[type="radio"]:checked + .gender-icon.male .gender-label {
    border-top-color: rgba(255,255,255,0.2);
}

input[type="radio"]:checked + .gender-icon.female {
    background: #d23765;
    color: #fff;
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(210, 55, 101, 0.2);
}

input[type="radio"]:checked + .gender-icon.female .gender-label {
    border-top-color: rgba(255,255,255,0.2);
}

input[type="radio"]:checked + .gender-icon.unknown {
    background: #555;
    color: #fff;
    transform: scale(1.05);
    box-shadow: 0 3px 10px rgba(85, 85, 85, 0.2);
}

input[type="radio"]:checked + .gender-icon.unknown .gender-label {
    border-top-color: rgba(255,255,255,0.2);
}

/* Hover state */
.gender-icon:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .gender-selector {
        flex-direction: row;
        justify-content: center;
        width: 100%;
        gap: 10px;
    }
    
    .gender-icon {
        flex: 1;
        padding: 15px;
        min-width: 80px;
        min-height: 100px;
    }
    
    .gender-icon .dashicons {
        font-size: 32px;
        width: 32px;
        height: 32px;
        margin-bottom: 12px;
    }
    
    .gender-label {
        font-size: 14px;
        padding-top: 8px;
    }
} 