/**
 * ORG Expense Manager — Frontend Form Styles
 * 
 * Provides clean, modern styling for the expense submission form.
 * Optimized for accessibility, mobile responsiveness, and WordPress admin bar compatibility.
 * 
 * @package ORG_Expense_Manager
 * @version 1.0.1
 */

/* ═══════════════════════════════════════════════════════════════════
   CONTAINER & LAYOUT
   ═══════════════════════════════════════════════════════════════════ */

.org-expense-form-container {
    max-width: 900px;
    margin: 2rem auto;
    padding: 0 1rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: #2c3338;
    scroll-margin-top: 60px; /* Account for sticky headers */
}

/* Messages */
.org-messages {
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    border-left: 4px solid;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Message show animation */
.org-messages.org-message-show {
    opacity: 1;
    transform: translateY(0);
    animation: org-message-pulse 0.6s ease;
}

@keyframes org-message-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.02);
    }
}

.org-messages.org-success {
    background-color: #e7f7ee;
    border-color: #00a32a;
    color: #00610c;
}

.org-messages.org-error {
    background-color: #fcf0f1;
    border-color: #d63638;
    color: #8a1f1f;
}

/* Make messages visible when displayed */
.org-messages[style*="display: block"] {
    opacity: 1;
    transform: translateY(0);
}

/* Focus outline for accessibility */
.org-messages:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════════
   FORM SECTIONS
   ═══════════════════════════════════════════════════════════════════ */

.org-form-section {
    background: #ffffff;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.org-section-title {
    margin: 0 0 1.5rem 0;
    font-size: 20px;
    font-weight: 600;
    color: #1e1e1e;
    border-bottom: 2px solid #f0f0f1;
    padding-bottom: 0.75rem;
}

/* ═══════════════════════════════════════════════════════════════════
   FORM GRID & FIELDS
   ═══════════════════════════════════════════════════════════════════ */

.org-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

@media (max-width: 768px) {
    .org-form-grid {
        grid-template-columns: 1fr;
    }
}

.org-field-group {
    display: flex;
    flex-direction: column;
}

.org-field-group.org-field-full {
    grid-column: 1 / -1;
}

.org-label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 14px;
    font-weight: 500;
    color: #1e1e1e;
}

.org-required {
    color: #d63638;
    font-weight: 600;
}

.org-label-hint {
    display: block;
    margin-top: 0.25rem;
    font-size: 12px;
    font-weight: 400;
    color: #646970;
}

/* ═══════════════════════════════════════════════════════════════════
   FORM INPUTS
   ═══════════════════════════════════════════════════════════════════ */

.org-input,
.org-select,
.org-textarea {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 14px;
    line-height: 1.5;
    color: #2c3338;
    background-color: #ffffff;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.org-input:focus,
.org-select:focus,
.org-textarea:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.org-input::placeholder,
.org-textarea::placeholder {
    color: #8c8f94;
}

.org-textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.org-select {
    cursor: pointer;
    appearance: none;
    background-image: url('data:image/svg+xml;charset=UTF-8,%3Csvg xmlns="http://www.w3.org/2000/svg" width="12" height="7" viewBox="0 0 12 7"%3E%3Cpath fill="%238c8f94" d="M6 7L0 1l1-1 5 5 5-5 1 1z"/%3E%3C/svg%3E');
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    padding-right: 2.5rem;
}

/* Input with prefix (e.g., $ symbol) */
.org-input-group {
    display: flex;
    align-items: stretch;
}

.org-input-prefix {
    display: flex;
    align-items: center;
    padding: 0 0.875rem;
    background-color: #f6f7f7;
    border: 1px solid #8c8f94;
    border-right: none;
    border-radius: 4px 0 0 4px;
    font-weight: 500;
    color: #50575e;
}

.org-input-group .org-input {
    border-radius: 0 4px 4px 0;
}

/* File input styling */
.org-input-file {
    font-size: 13px;
    padding: 0.5rem 0;
    border: none;
    cursor: pointer;
}

.org-input-file::file-selector-button {
    padding: 0.5rem 1rem;
    margin-right: 0.75rem;
    font-size: 13px;
    font-weight: 500;
    color: #2271b1;
    background-color: #f6f7f7;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.org-input-file::file-selector-button:hover {
    background-color: #ffffff;
    border-color: #2271b1;
}

/* ═══════════════════════════════════════════════════════════════════
   EXPENSE ITEMS
   ═══════════════════════════════════════════════════════════════════ */

.org-item-row {
    background: #f9f9f9;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    transition: box-shadow 0.2s ease;
}

.org-item-row:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.org-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e0e0e0;
}

.org-item-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #1e1e1e;
}

.org-remove-item {
    padding: 0.375rem 0.875rem;
    font-size: 13px;
    font-weight: 500;
    color: #d63638;
    background: #ffffff;
    border: 1px solid #d63638;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.org-remove-item:hover {
    background: #d63638;
    color: #ffffff;
}

.org-remove-item .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.org-item-fields {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 768px) {
    .org-item-fields {
        grid-template-columns: 1fr;
    }
}

/* Add Item Button */
.org-add-item-wrap {
    margin-top: 1rem;
}

.org-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 14px;
    font-weight: 500;
    color: #2271b1;
    background: #f6f7f7;
    border: 1px solid #2271b1;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.org-btn-secondary:hover {
    background: #2271b1;
    color: #ffffff;
}

.org-btn-secondary .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* ═══════════════════════════════════════════════════════════════════
   FORM FOOTER
   ═══════════════════════════════════════════════════════════════════ */

.org-form-footer {
    background: #f9f9f9;
    border: 1px solid #dcdcde;
    border-radius: 8px;
    padding: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

@media (max-width: 768px) {
    .org-form-footer {
        flex-direction: column;
        align-items: stretch;
    }
}

.org-total-display {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
}

.org-total-label {
    font-size: 18px;
    font-weight: 600;
    color: #1e1e1e;
}

.org-total-value {
    font-size: 28px;
    font-weight: 700;
    color: #00a32a;
}

.org-submit-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
}

@media (max-width: 768px) {
    .org-submit-wrap {
        align-items: stretch;
    }
}

.org-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 2rem;
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
    background: #2271b1;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(34, 113, 177, 0.2);
}

.org-btn-primary:hover {
    background: #135e96;
    box-shadow: 0 4px 8px rgba(34, 113, 177, 0.3);
    transform: translateY(-1px);
}

.org-btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(34, 113, 177, 0.2);
}

.org-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.org-btn-primary .dashicons {
    font-size: 20px;
    width: 20px;
    height: 20px;
}

/* Submitting indicator */
.org-submitting-indicator {
    display: none;
    align-items: center;
    gap: 0.75rem;
    font-size: 14px;
    color: #646970;
}

.org-submitting-indicator .spinner {
    float: none;
    margin: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   LOGIN NOTICE
   ═══════════════════════════════════════════════════════════════════ */

.org-login-notice {
    max-width: 600px;
    margin: 3rem auto;
    padding: 2rem;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-left: 4px solid #ff9800;
    border-radius: 6px;
    text-align: center;
}

.org-login-notice p {
    margin: 0;
    font-size: 15px;
    color: #856404;
}

.org-login-notice a {
    color: #0073aa;
    font-weight: 600;
    text-decoration: underline;
}

.org-login-notice a:hover {
    color: #005177;
}

/* ═══════════════════════════════════════════════════════════════════
   ACCESSIBILITY & FOCUS STATES
   ═══════════════════════════════════════════════════════════════════ */

.org-btn-secondary:focus,
.org-btn-primary:focus,
.org-remove-item:focus {
    outline: 2px solid #2271b1;
    outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════════════
   UTILITY CLASSES
   ═══════════════════════════════════════════════════════════════════ */

.org-btn-text-danger {
    /* Inherits from .org-remove-item */
}

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE ADJUSTMENTS
   ═══════════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .org-expense-form-container {
        padding: 0 0.5rem;
    }
    
    .org-form-section {
        padding: 1.25rem;
    }
    
    .org-section-title {
        font-size: 18px;
    }
    
    .org-item-row {
        padding: 1rem;
    }
    
    .org-form-footer {
        padding: 1.25rem;
    }
    
    .org-total-label {
        font-size: 16px;
    }
    
    .org-total-value {
        font-size: 24px;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   PRINT STYLES
   ═══════════════════════════════════════════════════════════════════ */

@media print {
    .org-remove-item,
    .org-add-item-wrap,
    .org-submit-wrap {
        display: none;
    }
    
    .org-form-section,
    .org-item-row {
        border: 1px solid #000;
        box-shadow: none;
    }
}
/* ═══════════════════════════════════════════════════════════════════
   TAX FIELDS
   ═══════════════════════════════════════════════════════════════════ */

.org-tax-helpers {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.org-btn-tax-helper {
    background: none;
    border: none;
    padding: 0;
    font-size: 11px;
    color: #2271b1;
    cursor: pointer;
    text-decoration: underline;
    line-height: 1.4;
}

.org-btn-tax-helper:hover {
    color: #135e96;
}

.org-pretax-row {
    padding: 4px 0;
}

.org-pretax-label {
    font-size: 12px;
    color: #646970;
}

.org-pretax-value {
    color: #1e1e1e;
}