/* UI/UX Fixes and Enhancements - SEO Master Pro */
/* Apply this after main.css for comprehensive fixes */

/* ========================================
   1. FORM IMPROVEMENTS
   ======================================== */

/* Better form control styling */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="url"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    color: #0B1B2B;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
    outline: none;
}

/* Ensure inputs with icons don't get overridden */
.input-icon input[type="text"],
.input-icon input[type="email"],
.input-icon input[type="password"],
.input-icon input[type="url"],
.input-icon input[type="number"] {
    padding-left: 3rem !important;
}

.input-icon input[type="password"] {
    padding-right: 3rem !important;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
textarea:focus,
select:focus {
    border-color: #0B66FF;
    background: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(11, 102, 255, 0.1);
}

/* Disabled state */
input:disabled,
textarea:disabled,
select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #F6F8FB;
}

/* Placeholder styling */
::placeholder {
    color: #6B7C93;
    opacity: 1;
}

/* Invalid/Error state */
input:invalid:not(:focus),
textarea:invalid:not(:focus) {
    border-color: #ef4444;
}

input.error,
textarea.error,
select.error {
    border-color: #ef4444 !important;
    background: rgba(239, 68, 68, 0.05);
}

/* Success state */
input.success,
textarea.success,
select.success {
    border-color: #10b981 !important;
    background: rgba(16, 185, 129, 0.05);
}

/* Form groups with consistent spacing */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    color: #0B1B2B;
    font-weight: 600;
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.form-group small {
    display: block;
    margin-top: 0.5rem;
    color: #6B7C93;
    font-size: 0.875rem;
    line-height: 1.4;
}

.form-text {
    display: block;
    margin-top: 0.5rem;
    color: #6B7C93;
    font-size: 0.875rem;
}

/* Error message display */
.error-message {
    display: block;
    margin-top: 0.5rem;
    color: #ef4444;
    font-size: 0.875rem;
    animation: slideIn 0.3s ease;
}

.success-message {
    display: block;
    margin-top: 0.5rem;
    color: #10b981;
    font-size: 0.875rem;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   2. BUTTON IMPROVEMENTS
   ======================================== */

.btn,
button[type="submit"],
button[type="button"],
.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

a.btn-primary {
    color: #fff !important;
}

/* Primary button */
.btn-primary,
button[type="submit"] {
    background: linear-gradient(135deg, #0B66FF 0%, #0952CC 100%);
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(11, 102, 255, 0.3);
}

.btn-primary:hover,
button[type="submit"]:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(11, 102, 255, 0.4);
    color: #0B66FF !important;

}

.btn-primary:active,
button[type="submit"]:active {
    transform: translateY(0);
}

/* Secondary button */
.btn-secondary {
    background: #FFFFFF;
    color: #0B1B2B;
    border: 1px solid #E5E7EB;
}

.btn-secondary:hover {
    background: #F6F8FB;
    border-color: #0B66FF;
}

/* Button sizes */
.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.125rem;
}

/* Button states */
.btn:disabled,
button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-loading {
    position: relative;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(0, 0, 0, 0.3);
    border-top-color: #000;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* Button icon spacing */
.btn i {
    font-size: 1rem;
}

/* ========================================
   3. NAVIGATION FIXES
   ======================================== */

/* Ensure consistent navigation styling */
.navbar,
.dashboard-nav {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #E5E7EB;
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-menu a,
.nav-links a,
.sidebar-nav a {
    color: #6B7C93;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-menu a:hover,
.nav-links a:hover,
.sidebar-nav a:hover {
    color: #0B66FF;
    background: rgba(11, 102, 255, 0.1);
}

.nav-menu a.active,
.nav-links a.active,
.sidebar-nav a.active {
    color: #0B66FF;
    background: rgba(11, 102, 255, 0.15);
}

/* ========================================
   4. CARD IMPROVEMENTS
   ======================================== */

.card,
.weaver-card,
.client-card,
.keyword-card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.card:hover,
.weaver-card:hover,
.client-card:hover,
.keyword-card:hover {
    border-color: #0B66FF;
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(11, 27, 43, 0.1);
}

.card-header {
    border-bottom: 1px solid #E5E7EB;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.card-header h2,
.card-header h3 {
    color: #0B1B2B;
    margin: 0;
}

.card-body {
    padding: 0;
}

/* ========================================
   5. TABLE IMPROVEMENTS
   ======================================== */

table {
    width: 100%;
    border-collapse: collapse;
    border-spacing: 0;
}

thead {
    background: rgba(11, 102, 255, 0.05);
}

th {
    color: #0B1B2B;
    font-weight: 600;
    padding: 1rem;
    text-align: left;
    border-bottom: 2px solid #E5E7EB;
}

td {
    padding: 1rem;
    border-bottom: 1px solid #E5E7EB;
}

tr:hover {
    background: #F6F8FB;
}

/* ========================================
   6. LOADING STATES
   ======================================== */

.loading-indicator,
.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(11, 102, 255, 0.2);
    border-top-color: #0B66FF;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1rem;
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(
        90deg,
        #E8ECF0 25%,
        #F0F4F8 50%,
        #E8ECF0 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: 1rem;
}

.skeleton-button {
    height: 2.5rem;
    width: 120px;
}

/* ========================================
   7. NOTIFICATION IMPROVEMENTS
   ======================================== */

.notification,
.alert,
.toast {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    color: #fff;
    font-weight: 500;
    z-index: 10000;
    animation: slideInRight 0.3s ease;
    max-width: 400px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.notification.success,
.alert-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.notification.error,
.alert-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.notification.warning,
.alert-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.notification.info,
.alert-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* ========================================
   8. RESPONSIVE IMPROVEMENTS
   ======================================== */

@media (max-width: 768px) {
    /* Container padding */
    .container {
        padding: 0 1rem;
    }

    /* Typography scaling */
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }

    /* Button full width on mobile */
    .btn-mobile-full {
        width: 100%;
        justify-content: center;
    }

    /* Stack form rows */
    .form-row {
        flex-direction: column;
    }

    /* Navigation */
    .navbar,
    .dashboard-nav {
        padding: 1rem;
    }

    /* Cards */
    .card,
    .weaver-card {
        padding: 1rem;
    }

    /* Table responsive */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* Notification */
    .notification {
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

/* ========================================
   9. ACCESSIBILITY IMPROVEMENTS
   ======================================== */

/* Focus visible for keyboard navigation */
*:focus-visible {
    outline: 2px solid #0B66FF;
    outline-offset: 2px;
}

/* Remove default focus */
*:focus {
    outline: none;
}

/* Skip to main content */
.skip-to-main {
    position: absolute;
    top: -40px;
    left: 0;
    background: #0B66FF;
    color: #FFFFFF;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 10001;
}

.skip-to-main:focus {
    top: 0;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ========================================
   10. UTILITY CLASSES
   ======================================== */

/* Text alignment */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* Text colors */
.text-primary { color: #0B66FF; }
.text-secondary { color: #6B7C93; }
.text-muted { color: #9CA3AF; }
.text-success { color: #10b981; }
.text-warning { color: #f59e0b; }
.text-error { color: #ef4444; }
.text-info { color: #0B66FF; }

/* Spacing utilities */
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* Display utilities */
.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-inline-flex { display: inline-flex; }

/* Flex utilities */
.flex-column { flex-direction: column; }
.flex-row { flex-direction: row; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* Width utilities */
.w-full { width: 100%; }
.w-auto { width: auto; }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

/* ========================================
   11. ANIMATIONS & TRANSITIONS
   ======================================== */

.fade-in {
    animation: fadeIn 0.5s ease;
}

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

.slide-up {
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Smooth transitions */
.transition-all {
    transition: all 0.3s ease;
}

/* ========================================
   12. EMPTY STATES
   ======================================== */

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #6B7C93;
}

.empty-state i {
    font-size: 4rem;
    color: #0B66FF;
    opacity: 0.3;
    margin-bottom: 1rem;
    display: block;
}

.empty-state h3 {
    color: #0B1B2B;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #6B7C93;
    margin-bottom: 1.5rem;
}

/* ========================================
   13. BADGES & TAGS
   ======================================== */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #f59e0b;
}

.badge-error {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.badge-info {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.badge-primary {
    background: rgba(11, 102, 255, 0.1);
    color: #0B66FF;
}

/* ========================================
   14. TOOLTIP
   ======================================== */

[data-tooltip] {
    position: relative;
    cursor: help;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    font-size: 0.875rem;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    z-index: 1000;
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* ========================================
   15. SCROLLBAR STYLING
   ======================================== */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #E8ECF0;
}

::-webkit-scrollbar-thumb {
    background: rgba(11, 102, 255, 0.3);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(11, 102, 255, 0.5);
}

/* Firefox scrollbar */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(11, 102, 255, 0.3) #E8ECF0;
}

/* ========================================
   16. MODAL STYLES
   ======================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(11, 27, 43, 0.6);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    backdrop-filter: blur(5px);
}

.modal.active {
    display: flex !important;
}

.modal-content {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease-out;
    box-shadow: 0 20px 60px rgba(11, 27, 43, 0.2);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #E5E7EB;
}

.modal-header h2 {
    font-size: 1.5rem;
    margin: 0;
    color: #0B1B2B;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-close {
    background: none;
    border: none;
    color: #6B7C93;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: all 0.3s ease;
    line-height: 1;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.modal-close:hover {
    color: #0B66FF;
    background: rgba(11, 102, 255, 0.1);
}

.modal-body {
    padding: 1.5rem;
}

.modal-body textarea {
    width: 100%;
    min-height: 120px;
    resize: vertical;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem;
    border-top: 1px solid #E5E7EB;
}

@media (max-width: 768px) {
    .modal {
        padding: 1rem;
    }

    .modal-content {
        max-width: 100%;
        max-height: 95vh;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
}
