/* Reusable Component Styles */

/* Cards */
.card {
    background: rgba(14, 22, 36, 0.95);
    border: 1px solid rgba(59, 130, 246, 0.12);
    border-radius: 18px;
    padding: 1.75rem;
    transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(18px);
}

.card:hover {
    border-color: rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.45);
}

/* Disable hover transform on touch devices to prevent stuck states */
@media (hover: none) {
    .card:hover {
        transform: none;
    }
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.card-body {
    color: var(--text-secondary);
    line-height: 1.8;
}

/* Input Groups */
.input-group {
    margin-bottom: 1.5rem;
}

.input-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-field {
    width: 100%;
    padding: 1rem;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s;
}

.input-field:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(74, 158, 255, 0.1);
}

.input-field::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
}

.input-field:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.input-hint {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    opacity: 0.85;
    margin-top: 0.5rem;
}

/* Search Bar */
.search-bar {
    position: relative;
    width: 100%;
}

.search-input {
    width: 100%;
    padding: 1.25rem 3rem 1.25rem 1.25rem;
    background: var(--input-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 1.1rem;
    transition: all 0.3s;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 4px rgba(74, 158, 255, 0.1);
}

.search-icon {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.5rem;
    pointer-events: none;
}

/* Alert Messages */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
}

.alert-icon {
    font-size: 1.5rem;
}

.alert-info {
    background: rgba(74, 158, 255, 0.1);
    border: 1px solid rgba(74, 158, 255, 0.3);
    color: var(--accent-blue);
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--accent-green);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: var(--accent-yellow);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--accent-red);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.55rem;
    min-height: 44px;
    min-width: 44px;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.btn-icon:hover {
    color: var(--accent-blue);
    border-color: rgba(59, 130, 246, 0.4);
    background: rgba(59, 130, 246, 0.12);
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 0.9rem;
    min-height: 44px;
    min-width: 44px;
    border-radius: 10px;
    border: 1px solid rgba(59, 130, 246, 0.25);
    background: rgba(59, 130, 246, 0.08);
    color: #93c5fd;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.btn-ghost svg {
    width: 18px;
    height: 18px;
}

.btn-ghost:hover {
    border-color: rgba(59, 130, 246, 0.45);
    background: rgba(59, 130, 246, 0.18);
    color: var(--text-primary);
}

.btn-ghost.danger {
    border-color: rgba(248, 113, 113, 0.35);
    background: rgba(248, 113, 113, 0.12);
    color: #fca5a5;
}

.btn-ghost.danger:hover {
    border-color: rgba(248, 113, 113, 0.55);
    background: rgba(248, 113, 113, 0.2);
    color: #fee2e2;
}

.btn-link {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.5rem;
    min-height: 44px;
    min-width: 44px;
    background: none;
    border: none;
    color: #93c5fd;
    font-weight: 600;
    cursor: pointer;
    transition: color 0.2s ease;
    touch-action: manipulation;
}

.btn-link:hover {
    color: var(--accent-blue);
    text-decoration: underline;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-blue {
    background: var(--accent-blue);
    color: white;
}

.badge-purple {
    background: var(--accent-purple);
    color: white;
}

.badge-green {
    background: var(--accent-green);
    color: white;
}

.badge-yellow {
    background: var(--accent-yellow);
    color: var(--primary-bg);
}

.badge-red {
    background: var(--accent-red);
    color: white;
}

.badge-gray {
    background: var(--border-color);
    color: var(--text-secondary);
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 0.9rem;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(148, 163, 184, 0.25);
    color: var(--text-primary);
    box-shadow: 0 8px 20px rgba(8, 12, 22, 0.4);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 11000;
    max-width: 320px;
    pointer-events: none;
}

.toast-visible {
    opacity: 1;
    transform: translateY(0);
}

.toast-icon {
    font-size: 0.875rem;
    line-height: 1;
    flex-shrink: 0;
}

.toast-message {
    font-size: 0.8125rem;
    line-height: 1.4;
}

.toast-success {
    border-left: 3px solid var(--accent-green);
}

.toast-error {
    border-left: 3px solid var(--accent-red);
}

.toast-info {
    border-left: 3px solid var(--accent-blue);
}

.toast-warning {
    border-left: 3px solid var(--accent-yellow);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(7, 12, 22, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    animation: fadeIn 0.3s forwards;
    padding: 20px;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.modal-content {
    background: rgba(14, 22, 36, 0.98);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    transform: scale(0.95);
    animation: scaleIn 0.3s forwards;
    overflow: hidden;
}

.modal-content.modal-lg {
    max-width: 800px;
}

@keyframes scaleIn {
    to {
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid rgba(59, 130, 246, 0.12);
    background: rgba(9, 15, 27, 0.6);
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    line-height: 1;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--accent-blue);
    color: var(--text-primary);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: transparent;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid rgba(59, 130, 246, 0.12);
    background: rgba(9, 15, 27, 0.4);
}

/* Form Styles for Modals */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group-full {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 14px;
    font-size: 14px;
    background: rgba(9, 15, 27, 0.8);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    background: rgba(9, 15, 27, 0.95);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
    font-family: inherit;
}

.form-group select {
    cursor: pointer;
}

/* Button Styles for Modals */
.modal-footer .btn-primary,
.modal-footer .btn-secondary {
    padding: 12px 24px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
}

.modal-footer .btn-primary {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.modal-footer .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.3);
}

.modal-footer .btn-secondary {
    background: rgba(9, 15, 27, 0.8);
    color: var(--text-primary);
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.modal-footer .btn-secondary:hover {
    background: rgba(59, 130, 246, 0.12);
    border-color: var(--accent-blue);
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        max-height: 100vh;
    }

    .toast {
        bottom: 16px;
        right: 16px;
        left: 16px;
        max-width: none;
        padding: 0.6rem 0.85rem;
        font-size: 0.8rem;
    }

    .toast-message {
        font-size: 0.75rem;
    }
}

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

/* Loading Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--accent-blue);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 2rem auto;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-message {
    font-size: 1rem;
    margin-bottom: 2rem;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(
        90deg,
        rgba(14, 22, 36, 0.4) 0%,
        rgba(59, 130, 246, 0.08) 50%,
        rgba(14, 22, 36, 0.4) 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.8s ease-in-out infinite;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
    border-radius: 4px;
}

.skeleton-title {
    height: 24px;
    width: 60%;
    margin-bottom: 16px;
    border-radius: 6px;
}

.skeleton-card {
    height: 200px;
    border-radius: 12px;
    border: 1px solid rgba(59, 130, 246, 0.08);
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-button {
    height: 40px;
    width: 120px;
    border-radius: 8px;
}

.skeleton-stat {
    height: 80px;
    border-radius: 10px;
}

/* Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip-text {
    visibility: hidden;
    background: var(--card-bg);
    color: var(--text-primary);
    text-align: center;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    opacity: 0;
    transition: opacity 0.2s;
    white-space: nowrap;
    font-size: 0.875rem;
}

.tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Divider */
.divider {
    height: 1px;
    background: var(--border-color);
    margin: 2rem 0;
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 2rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-1 {
    gap: 0.5rem;
}

.gap-2 {
    gap: 1rem;
}

.gap-3 {
    gap: 1.5rem;
}

.gap-4 {
    gap: 2rem;
}
