/* Email Sender - Custom CSS */

/* Loading spinner animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.animate-spin {
    animation: spin 1s linear infinite;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #94a3b8;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

/* Focus styles - remove outlines from all elements */
*:focus, *:focus-visible {
    outline: none !important;
}

/* Remove focus rings from buttons and links */
button:focus, button:focus-visible,
a:focus, a:focus-visible,
[type="button"]:focus, [type="submit"]:focus, [type="reset"]:focus {
    --tw-ring-offset-shadow: none !important;
    --tw-ring-shadow: none !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Remove default button borders */
button {
    border: none;
    outline: none;
}

/* Transition for all elements */
a, button, input, select, textarea {
    transition: all 0.15s ease;
}

/* ================================================
   FLOATING LABEL INPUT STYLE
   ================================================ */

.floating-group {
    position: relative;
}

.floating-group .floating-input,
.floating-group .floating-select,
.floating-group .floating-textarea {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 16px; /* 16px prevents iOS zoom on focus */
    color: #334155;
    background-color: white;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Floating select with custom arrow */
.floating-group .floating-select {
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3e%3c/path%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 20px;
    cursor: pointer;
}

.floating-group .floating-select:focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%233b82f6'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3e%3c/path%3e%3c/svg%3e");
}

.floating-group .floating-input:focus,
.floating-group .floating-select:focus,
.floating-group .floating-textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.floating-group .floating-label {
    position: absolute;
    left: 12px;
    top: -8px;
    padding: 0 6px;
    font-size: 12px;
    font-weight: 400;
    color: #64748b;
    background: white;
    pointer-events: none;
    transition: all 0.2s ease;
}

.floating-group .floating-input:focus + .floating-label,
.floating-group .floating-select:focus + .floating-label,
.floating-group .floating-textarea:focus + .floating-label {
    color: #3b82f6;
}

/* With icon variant */
.floating-group.with-icon .floating-input,
.floating-group.with-icon .floating-select {
    padding-left: 44px;
}

/* With icon variant for select - ensure arrow padding is kept */
.floating-group.with-icon .floating-select {
    padding-right: 40px;
}

.floating-group.with-icon .floating-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: #94a3b8;
    pointer-events: none;
}

.floating-group.with-icon .floating-input:focus ~ .floating-icon,
.floating-group.with-icon .floating-select:focus ~ .floating-icon {
    color: #3b82f6;
}

/* Textarea variant */
.floating-group .floating-textarea {
    min-height: 120px;
    resize: vertical;
}

/* ================================================ */

/* Drag and drop zone styles */
.drop-zone {
    transition: all 0.2s ease;
}

.drop-zone.dragging {
    border-color: #334155;
    background-color: #f8fafc;
}

/* Table styles */
table {
    border-collapse: collapse;
    width: 100%;
}

/* Modal backdrop */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 50;
}

.modal-content {
    background-color: white;
    border-radius: 0.75rem;
    max-width: 28rem;
    width: 100%;
    padding: 1.5rem;
    max-height: 90vh;
    overflow-y: auto;
}

/* Message toast animations */
.toast-enter {
    opacity: 0;
    transform: translateY(-1rem);
}

.toast-enter-active {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.3s ease;
}

/* Print styles */
@media print {
    nav, aside, .no-print {
        display: none !important;
    }
    
    main {
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* Image gallery */
.image-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.75rem;
}

.image-gallery-item {
    aspect-ratio: 1;
    position: relative;
    overflow: hidden;
    border-radius: 0.5rem;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    transition: border-color 0.2s ease;
}

.image-gallery-item:hover {
    border-color: #334155;
}

.image-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-gallery-item .overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.image-gallery-item:hover .overlay {
    background-color: rgba(0, 0, 0, 0.3);
}

.image-gallery-item .overlay svg {
    opacity: 0;
    color: white;
    transition: opacity 0.2s ease;
}

.image-gallery-item:hover .overlay svg {
    opacity: 1;
}

/* Email preview */
.email-preview {
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    padding: 1rem;
}

/* Badge styles */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-success {
    background-color: #dcfce7;
    color: #166534;
}

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

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

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

/* Status indicators */
.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.success { background-color: #22c55e; }
.status-dot.error { background-color: #ef4444; }
.status-dot.warning { background-color: #f59e0b; }
.status-dot.pending { background-color: #3b82f6; }

/* Responsive table */
@media (max-width: 768px) {
    .responsive-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* Button loading state */
.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
}

/* ================================================
   UNIFIED CHECKBOX STYLE
   ================================================ */

input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 1.125rem;
    height: 1.125rem;
    border: 1.5px solid #94a3b8;
    border-radius: 4px;
    background-color: white;
    cursor: pointer;
    position: relative;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

input[type="checkbox"]:hover {
    border-color: #64748b;
}

input[type="checkbox"]:checked {
    background-color: #64748b;
    border-color: #64748b;
}

input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

input[type="checkbox"]:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(100, 116, 139, 0.2);
}

input[type="checkbox"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Statisztika számok */
.stat-number {
    font-size: 1.2rem;
    line-height: 1.6rem;
}

/* ================================================
   CROSS-PLATFORM INPUT/SELECT NORMALIZATION (iOS fix)
   ================================================ */

/* Reset iOS default styles for all inputs */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="tel"],
input[type="url"],
input[type="search"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
textarea,
select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border-radius: 8px;
    background-color: white;
    border: 1px solid #cbd5e1;
    font-size: 16px; /* Prevents iOS zoom on focus */
    color: #334155;
    padding: 10px 16px;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Focus state */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus,
textarea:focus,
select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

/* Select specific - add custom arrow */
select {
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3e%3c/path%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 20px;
    cursor: pointer;
}

select:focus {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%233b82f6'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3e%3c/path%3e%3c/svg%3e");
}

/* Date inputs - fix iOS styling */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
    min-height: 40px;
}

/* Disabled state */
input:disabled,
select:disabled,
textarea:disabled {
    background-color: #f1f5f9;
    color: #94a3b8;
    cursor: not-allowed;
    opacity: 1; /* Override iOS default opacity */
}

/* Placeholder color */
input::placeholder,
textarea::placeholder {
    color: #94a3b8;
    opacity: 1;
}

/* Remove iOS input shadow */
input,
textarea,
select {
    -webkit-box-shadow: none;
    box-shadow: none;
}

/* Fix iOS date input text alignment */
input[type="date"]::-webkit-date-and-time-value {
    text-align: left;
}

/* Remove iOS inner shadow on inputs */
input:not([type="checkbox"]):not([type="radio"]) {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}
