/* ============================================
   CloudSaver UI Polish - Phase 3
   Form validation, loading states, improvements
   ============================================ */

/* Form Validation States */
.form-control.is-invalid,
input.is-invalid,
textarea.is-invalid,
select.is-invalid {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-control.is-valid,
input.is-valid,
textarea.is-valid,
select.is-valid {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.invalid-feedback {
    display: none;
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-control.is-invalid ~ .invalid-feedback,
input.is-invalid ~ .invalid-feedback,
textarea.is-invalid ~ .invalid-feedback,
select.is-invalid ~ .invalid-feedback {
    display: block;
}

.valid-feedback {
    display: none;
    color: #10b981;
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.form-control.is-valid ~ .valid-feedback,
input.is-valid ~ .valid-feedback,
textarea.is-valid ~ .valid-feedback,
select.is-valid ~ .valid-feedback {
    display: block;
}

/* Better Focus States */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #667eea !important;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transition: border-color 0.2s, box-shadow 0.2s;
}

/* Loading Spinner (Centered) */
.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spinner-rotate 0.8s linear infinite;
}

.spinner-sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner-lg {
    width: 60px;
    height: 60px;
    border-width: 6px;
}

@keyframes spinner-rotate {
    to { transform: rotate(360deg); }
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    gap: 1rem;
}

.loading-text {
    color: #6b7280;
    font-size: 0.875rem;
}

/* Enhanced Empty States */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #6b7280;
}

.empty-state-icon {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    opacity: 0.3;
    filter: grayscale(20%);
}

.empty-state h3 {
    font-size: 1.25rem;
    color: #1f2937;
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.empty-state p {
    font-size: 0.95rem;
    margin-bottom: 2rem;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

/* Card Hover Effects */
.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: box-shadow 0.2s ease;
}

/* Better Disabled States */
button:disabled,
.btn:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Smooth Transitions */
.card,
.btn,
input,
select,
textarea {
    transition: all 0.2s ease;
}

/* Badge Polish */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

.badge-warning {
    background: #fef3c7;
    color: #92400e;
}

.badge-info {
    background: #dbeafe;
    color: #1e40af;
}

.badge-secondary {
    background: #f3f4f6;
    color: #374151;
}

/* Toast Improvements (if needed) */
.toast {
    animation: toast-slide-in 0.3s ease;
}

@keyframes toast-slide-in {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Table Row Hover */
table tbody tr:hover {
    background-color: #f9fafb;
    transition: background-color 0.15s ease;
}

/* Input Group Polish */
.input-group {
    display: flex;
    align-items: stretch;
}

.input-group input {
    border-radius: 0;
}

.input-group input:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.input-group input:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    color: #6b7280;
    font-size: 0.875rem;
}

/* Progress Bar */
.progress {
    height: 8px;
    background: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: #667eea;
    border-radius: 9999px;
    transition: width 0.3s ease;
}

/* Tooltip Enhancement */
[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: #1f2937;
    color: white;
    font-size: 0.75rem;
    border-radius: 6px;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 0.5rem;
}

[data-tooltip]:hover::before {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #1f2937;
    z-index: 1000;
}
