/**
 * Tim Truett Referrals - Styles
 * Matching the design from the screenshots
 */

/* Container */
.ttr-form-container {
    margin: 0;
    padding: 20px 0;
}

/* Referrer Information Section */
.ttr-referrer-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 4px;
    margin-bottom: 30px;
    border: 1px solid #ddd;
}

.ttr-section-title {
    margin: 0 0 15px 0;
    padding: 0;
    font-size: 18px;
    font-weight: 600;
    color: #003d82;
}

.ttr-referrer-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.ttr-field {
    display: flex;
    flex-direction: column;
}

.ttr-field label {
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
    font-size: 14px;
}

.ttr-field .required {
    color: #b91c2e;
}

/* Table Wrapper */
.ttr-table-wrapper {
    overflow-x: auto;
    margin-bottom: 20px;
}

/* Referral Table */
.ttr-referral-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Table Headers */
.ttr-referral-table thead {
    background-color: #003d82;
    color: #ffffff;
}

.ttr-referral-table thead th {
    padding: 15px 10px;
    text-align: left;
    font-weight: 600;
    font-size: 16px;
    border: 1px solid #003d82;
    color: #ffffff !important;
}

/* First column (number) styling */
.ttr-referral-table thead th:first-child {
    width: 60px;
    text-align: center;
}

/* Table Body */
.ttr-referral-table tbody tr {
    border-bottom: 1px solid #ddd;
}

.ttr-referral-table tbody tr:last-child {
    border-bottom: none;
}

.ttr-referral-table tbody td {
    padding: 10px;
    border: 1px solid #ddd;
}

/* Row number cell */
.ttr-row-number {
    text-align: center;
    font-weight: 600;
    color: #003d82;
    font-size: 16px;
}

/* Input Fields */
.ttr-input,
.ttr-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    font-family: inherit;
    box-sizing: border-box;
    transition: border-color 0.3s ease;
}

.ttr-input:focus,
.ttr-select:focus {
    outline: none;
    border-color: #003d82;
    box-shadow: 0 0 0 2px rgba(0, 61, 130, 0.1);
}

.ttr-input::placeholder {
    color: #999;
}

/* Select dropdown */
.ttr-select {
    cursor: pointer;
    background-color: #fff;
}

/* Add Row Container */
.ttr-add-row-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 15px;
    padding: 10px 0;
    position: relative;
    z-index: 999999 !important;
    isolation: isolate;
}

/* Add Row Button */
.ttr-add-row-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 5px;
    background-color: #003d82 !important;
    color: #fff !important;
    border: none !important;
    padding: 10px 20px !important;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer !important;
    transition: background-color 0.3s ease;
    position: relative;
    z-index: 9999999 !important;
    pointer-events: auto !important;
    touch-action: manipulation !important;
}

.ttr-add-row-btn:hover {
    background-color: #002556;
}

.ttr-add-row-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.ttr-add-row-btn .dashicons {
    width: 18px;
    height: 18px;
    font-size: 18px;
}

/* Row Count */
.ttr-row-count {
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

#ttr-current-rows {
    font-weight: 700;
    color: #003d82;
}

/* Submit Button Container */
.ttr-submit-container {
    margin-top: 20px;
    text-align: left;
}

/* Submit Button - Matching the red button from screenshots */
.ttr-submit-btn {
    background-color: #b91c2e;
    color: #ffffff;
    border: none;
    padding: 15px 50px;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: background-color 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ttr-submit-btn:hover {
    background-color: #9a1825;
}

.ttr-submit-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Message Container */
.ttr-message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 4px;
    display: none;
    font-size: 14px;
}

.ttr-message.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    display: block;
}

.ttr-message.error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    display: block;
}

/* Loading State */
.ttr-form.loading {
    opacity: 0.6;
    pointer-events: none;
}

.ttr-submit-btn.loading::after {
    content: "...";
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: "."; }
    40% { content: ".."; }
    60%, 100% { content: "..."; }
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .ttr-referral-table {
        font-size: 14px;
    }
    
    .ttr-referral-table thead th {
        padding: 12px 8px;
        font-size: 14px;
    }
    
    .ttr-referral-table tbody td {
        padding: 8px;
    }
    
    .ttr-input,
    .ttr-select {
        padding: 8px 10px;
        font-size: 13px;
    }
    
    .ttr-submit-btn {
        padding: 15px 20px;
    }
    
    .ttr-add-row-container {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }
    
    .ttr-add-row-btn {
        width: 100%;
        justify-content: center;
    }
    
    .ttr-referrer-fields {
        grid-template-columns: 1fr;
    }
}

@media screen and (max-width: 480px) {
    /* Improve mobile display without breaking table structure */
    .ttr-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .ttr-referral-table {
        min-width: 600px;
        font-size: 13px;
    }
    
    .ttr-referral-table thead th {
        padding: 10px 8px;
        font-size: 13px;
    }
    
    .ttr-referral-table tbody td {
        padding: 8px;
    }
    
    .ttr-input,
    .ttr-select {
        padding: 8px;
        font-size: 13px;
    }
}

/* Business Form Specific Styles */
.ttr-business-form .ttr-referral-table thead th {
    width: 25%;
}

.ttr-business-form .ttr-referral-table tbody td {
    width: 25%;
}

.ttr-business-form .ttr-referral-table tbody tr {
    background-color: #fff;
}

.ttr-business-form .ttr-referral-table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Animation for new rows */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ttr-referral-row.new-row {
    animation: slideIn 0.3s ease;
}
