/* Custom Styles for PostPilot */

/* Smooth transitions */
* {
    transition: all 0.2s ease;
}

/* Line clamp utility for text truncation */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

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

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

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

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Modal backdrop animation */
#oauth-callback-modal,
#create-post-modal,
#delete-confirmation-modal {
    animation: fadeIn 0.2s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Card hover effects */
.bg-white:hover {
    transform: translateY(-2px);
}

/* Button hover effects */
button {
    cursor: pointer;
}

button:active {
    transform: scale(0.98);
}

/* Toast notification animation */
#toast {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

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

/* Form input focus states */
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Image error state */
img[onerror] {
    background-color: #f3f4f6;
}

/* Status badges */
.bg-green-100 {
    background-color: #d1fae5;
}

.text-green-800 {
    color: #065f46;
}

.bg-yellow-100 {
    background-color: #fef3c7;
}

.text-yellow-800 {
    color: #92400e;
}

.bg-blue-100 {
    background-color: #dbeafe;
}

.text-blue-800 {
    color: #1e40af;
}

.bg-red-100 {
    background-color: #fee2e2;
}

.text-red-800 {
    color: #991b1b;
}

/* Navigation active state */
nav button.text-blue-600 {
    font-weight: 600;
}

/* Empty state illustrations */
svg.text-gray-400 {
    opacity: 0.5;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .max-w-7xl {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    nav .flex {
        flex-wrap: wrap;
    }

    #create-post-modal > div {
        width: 95%;
        max-width: 95%;
        margin: 1rem;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode */
    /*
    body {
        background-color: #1f2937;
        color: #f9fafb;
    }

    .bg-white {
        background-color: #374151;
    }

    .text-gray-900 {
        color: #f9fafb;
    }

    .text-gray-600 {
        color: #d1d5db;
    }

    .bg-gray-50 {
        background-color: #111827;
    }
    */
}

/* Utility classes */
.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Card grid responsive spacing */
.grid {
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .grid {
        gap: 2rem;
    }
}

/* Form validation states */
input:invalid:not(:placeholder-shown),
textarea:invalid:not(:placeholder-shown) {
    border-color: #ef4444;
}

input:valid:not(:placeholder-shown),
textarea:valid:not(:placeholder-shown) {
    border-color: #10b981;
}

/* Button disabled state */
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

button:disabled:hover {
    transform: none;
}

/* Image gallery overflow handling */
.overflow-x-auto {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e0 transparent;
}

.overflow-x-auto::-webkit-scrollbar {
    height: 6px;
}

.overflow-x-auto::-webkit-scrollbar-thumb {
    background-color: #cbd5e0;
    border-radius: 3px;
}

/* Accessibility improvements */
button:focus-visible,
a:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Print styles */
@media print {
    nav,
    button,
    #toast,
    .shadow,
    .shadow-lg,
    .shadow-md {
        display: none !important;
    }

    body {
        background: white;
    }

    .bg-white {
        box-shadow: none !important;
    }
}
