/* Authentication Pages Styles */

.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - var(--header-height) - 40px);
    padding: var(--space-xl);
    background-color: var(--neutral-100);
    position: relative;
    z-index: 0;
}

.auth-box {
    width: 900px !important;
    margin-bottom: 30px;
    background-color: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 450px;
    padding: var(--space-xl);
    position: relative;
    overflow: hidden;
    /* Changed from visible to contain elements */
    animation: fadeInUp 0.5s ease-out;
    z-index: 1;
    display: flex;
    /* Added for internal structure */
    flex-direction: column;
    /* Added for internal structure */
    height: 100%;
    /* Ensure box takes full height of column */
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-header {
    text-align: center;
    margin-bottom: var(--space-xl);
    position: relative;
}

.auth-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: var(--space-md);
    display: inline-block;
    background-color: rgba(255, 110, 0, 0.1);
    width: 80px;
    height: 80px;
    line-height: 80px;
    border-radius: 50%;
    text-align: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 110, 0, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(255, 110, 0, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 110, 0, 0);
    }
}

.auth-box h1 {
    color: var(--secondary);
    margin-bottom: var(--space-xs);
    font-size: 1.8rem;
    font-weight: 600;
    font-family: var(--font-heading);
}

.auth-subtitle {
    color: var(--neutral-600);
    font-size: 1rem;
    margin-bottom: var(--space-lg);
}

.auth-form {
    display: block;
    width: 100%;
    position: relative;
    z-index: 2;
}

.auth-form .form-group {
    margin-bottom: var(--space-lg);
    position: relative;
    z-index: 2;
    width: 100%;
    display: block;
}

.auth-form label {
    display: flex;
    align-items: center;
    margin-bottom: var(--space-xs);
    font-weight: 500;
    color: var(--neutral-700);
    font-size: 0.95rem;
}

.auth-form label i {
    margin-right: var(--space-xs);
    color: var(--primary);
    width: 20px;
    text-align: center;
}

.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"] {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--neutral-300);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all var(--transition-normal);
    background-color: var(--neutral-50);
    height: auto;
    display: block;
    box-sizing: border-box;
    margin: 0;
    position: relative;
    z-index: 2;
}

.auth-form input[type="text"]:focus,
.auth-form input[type="email"]:focus,
.auth-form input[type="password"]:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 110, 0, 0.2);
    background-color: white;
}

.auth-form input.input-error {
    border-color: var(--danger);
    background-color: rgba(220, 53, 69, 0.05);
}

.auth-form input.input-error:focus {
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.2);
}

.field-error {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 5px;
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auth-form input[type="text"]::placeholder,
.auth-form input[type="email"]::placeholder,
.auth-form input[type="password"]::placeholder {
    color: var(--neutral-500);
    font-size: 0.9rem;
}

.password-input-container {
    position: relative;
    z-index: 2;
    display: block;
    width: 100%;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--neutral-600);
    cursor: pointer;
    padding: 0;
    font-size: 1rem;
    transition: color var(--transition-fast);
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
}

.password-toggle:hover {
    color: var(--primary);
}

.remember-me {
    display: flex;
    align-items: center;
    margin-bottom: var(--space-md);
}

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 30px;
    cursor: pointer;
    font-size: 0.9rem;
    user-select: none;
    color: var(--neutral-700);
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 20px;
    width: 20px;
    background-color: var(--neutral-200);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.checkbox-container:hover input~.checkmark {
    background-color: var(--neutral-300);
}

.checkbox-container input:checked~.checkmark {
    background-color: var(--primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked~.checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 7px;
    top: 3px;
    width: 6px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label {
    margin-left: var(--space-xs);
}

.auth-footer {
    margin-top: var(--space-xl);
    text-align: center;
    padding-top: var(--space-lg);
    border-top: 1px solid var(--neutral-200);
    color: var(--neutral-600);
    font-size: 0.9rem;
}

.auth-footer a {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
    transition: color var(--transition-fast);
}

.auth-footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Responsive Design for Auth Pages */
@media (max-width: 768px) {
    .auth-box {
        max-width: 100%;
        padding: var(--space-lg);
        margin: 0 var(--space-sm);
    }

    .auth-icon {
        width: 70px;
        height: 70px;
        line-height: 70px;
        font-size: 2rem;
    }

    .auth-box h1 {
        font-size: 1.6rem;
    }

    .auth-subtitle {
        font-size: 0.9rem;
    }

    .btn {
        width: 100%;
        padding: 12px 16px;
    }
}

@media (max-width: 480px) {
    .auth-container {
        padding: var(--space-md);
    }

    .auth-box {
        padding: var(--space-md);
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }

    .auth-icon {
        width: 60px;
        height: 60px;
        line-height: 60px;
        font-size: 1.8rem;
        margin-bottom: var(--space-sm);
    }

    .auth-form {
        display: block;
        width: 100%;
        position: relative;
        z-index: 2;
    }

    .auth-form .form-group {
        margin-bottom: var(--space-md);
    }

    .auth-form label {
        font-size: 0.9rem;
    }

    .auth-form input[type="text"],
    .auth-form input[type="email"],
    .auth-form input[type="password"] {
        padding: 10px 12px;
        font-size: 0.95rem;
    }

    .checkbox-container {
        font-size: 0.85rem;
    }

    .auth-footer {
        margin-top: var(--space-lg);
        padding-top: var(--space-md);
        font-size: 0.85rem;
    }
}

/* =================================== */
/* API Tokens Page Specific Styles     */
/* =================================== */

/* Override auth-box max-width for the two-column layout */
.api-token-page .auth-box {
    max-width: none;
    /* Remove the narrow constraint */
}

/* Styles for the custom header/body inside auth-box */
.auth-box-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--neutral-200);
    background-color: var(--neutral-50);
    /* Light background like card header */
}

.auth-box-header h2 {
    margin: 0;
    font-size: 1.1rem;
    /* Slightly smaller than main page title */
    font-weight: 600;
    color: var(--neutral-800);
    font-family: var(--font-heading);
}

.auth-box-body {
    padding: var(--space-lg);
    flex-grow: 1;
    /* Allow body to fill space */
    overflow-y: auto;
    /* Add scroll if content overflows */
}

/* Ensure form inside auth-box takes full width */
.create-token-box .auth-form {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.create-token-box .auth-form .form-group {
    flex-grow: 1;
    /* Push actions to bottom */
}

.create-token-box .auth-form .form-actions {
    margin-top: auto;
    /* Stick to bottom */
    padding-top: var(--space-lg);
}


/* --- Table Styling (Scoped within token list box) --- */
.token-list-box .auth-box-body {
    padding: 0;
    /* Remove padding to allow table to span full width */
}

.token-list-box .table-responsive {
    padding: var(--space-lg);
    /* Add padding around the table */
    padding-bottom: 0;
    /* No bottom padding before pagination */
}

/* --- Table Styling --- */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 0;
    /* Reset default table margin */
    table-layout: auto;
}

.table th,
.table td {
    padding: var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--neutral-200);
    vertical-align: middle;
    font-size: 0.95rem;
}

.table th {
    font-weight: 600;
    color: var(--neutral-700);
    background-color: var(--neutral-100);
    /* Header background */
    /* position: sticky; */
    /* Sticky header might conflict with auth-box scroll */
    /* top: 0; */
    /* z-index: 10; */
}

.table th:first-child {
    width: 30%;
}

.table th:nth-child(2),
.table th:nth-child(3) {
    width: 25%;
}

.table th:last-child {
    width: 20%;
}

.table td {
    color: var(--neutral-800);
    word-break: break-word;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: var(--neutral-50);
}

.table tbody tr:hover {
    background-color: var(--neutral-100);
}

/* --- Pagination (Scoped within token list box) --- */
.token-list-box .api-tokens-pagination {
    display: flex;
    justify-content: center;
    margin-top: 0;
    /* Remove top margin */
    padding: var(--space-md) var(--space-lg);
    /* Add padding */
    border-top: 1px solid var(--neutral-200);
    background-color: var(--neutral-50);
    /* Match header background */
}

.api-tokens-pagination .pagination {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: var(--space-xs);
}

.api-tokens-pagination .page-item {
    margin: 0;
}

.api-tokens-pagination .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 var(--space-sm);
    border-radius: var(--radius-md);
    background-color: white;
    border: 1px solid var(--neutral-300);
    color: var(--neutral-700);
    text-decoration: none;
    transition: all var(--transition-fast);
}

.api-tokens-pagination .page-link:hover {
    background-color: var(--neutral-100);
    color: var(--primary);
    border-color: var(--primary-light);
    text-decoration: none;
}

.api-tokens-pagination .page-item.active .page-link {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.api-tokens-pagination .page-item.disabled .page-link {
    color: var(--neutral-400);
    pointer-events: none;
    background-color: var(--neutral-100);
    border-color: var(--neutral-200);
}

/* --- Form Styling (General - applied via .auth-form) --- */
/* .form-group, label, .form-control styles are now handled by .auth-form rules */
/* Keep .form-text if used outside .auth-form context */

/* .form-control styles handled by .auth-form */

.form-text {
    /* Keep if needed */
    font-size: 0.85rem;
    color: var(--neutral-600);
    margin-top: var(--space-xs);
}

.text-muted {
    color: var(--neutral-600);
}

/* .form-actions are styled within .auth-form context */
/* Keep general .form-actions if used elsewhere */
.form-actions {
    margin-top: var(--space-lg);
    text-align: left;
    /* Default alignment */
}

/* --- Button Styling --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-normal);
    min-width: auto;
    text-decoration: none !important;
    /* Ensure no underline */
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border: 1px solid transparent;
    /* Add border for consistency */
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--neutral-600);
    color: white;
    border: 1px solid transparent;
}

.btn-secondary:hover {
    background-color: var(--neutral-700);
}

.btn-danger {
    background-color: var(--danger);
    color: white;
    border: 1px solid transparent;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 0.85rem;
}

.delete-token-form {
    display: inline-block;
    margin: 0;
}

/* --- Modal Styling --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal.fade {
    opacity: 0;
    transition: opacity 0.15s linear;
}

.modal.show {
    opacity: 1;
}

.modal-dialog {
    position: relative;
    width: auto;
    margin: 5vh auto;
    max-width: 500px;
}

.modal-content {
    position: relative;
    background-color: white;
    border-radius: var(--radius-md);
    border: none;
    /* Keep borderless */
    box-shadow: var(--shadow-lg);
    /* Use larger shadow like auth-box */
    outline: 0;
}

.modal-header {
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--neutral-200);
    background-color: var(--neutral-50);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--neutral-800);
    font-family: var(--font-heading);
}

.modal-body {
    padding: var(--space-lg);
}

.modal-footer {
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--neutral-200);
    text-align: right;
}

.close {
    float: right;
    font-size: 1.2rem;
    font-weight: 700;
    line-height: 1;
    color: var(--neutral-600);
    text-shadow: none;
    opacity: 0.5;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.close:hover {
    opacity: 1;
    color: var(--neutral-800);
}

.input-group {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    width: 100%;
}

.input-group-append {
    margin-left: -1px;
    display: flex;
}

.input-group>.form-control {
    position: relative;
    flex: 1 1 auto;
    width: 1%;
    margin-bottom: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.input-group-append .btn {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.btn-outline-secondary {
    color: var(--neutral-700);
    /* Slightly darker text */
    border: 1px solid var(--neutral-400);
    /* Lighter border */
    background-color: transparent;
}

.btn-outline-secondary:hover {
    color: var(--neutral-800);
    background-color: var(--neutral-200);
    /* Light background on hover */
    border-color: var(--neutral-400);
}

/* --- Alert Styling --- */
.alert {
    display: flex;
    align-items: center;
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    border-radius: var(--radius-md);
    border-left: 4px solid;
    font-size: 0.95rem;
    position: relative;
}

.alert-success {
    background-color: #d4edda;
    border-color: var(--success);
    color: #155724;
}

.alert-error,
.alert-danger {
    background-color: #f8d7da;
    border-color: var(--danger);
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    border-color: var(--warning);
    color: #856404;
}

.alert-info {
    background-color: #d1ecf1;
    border-color: var(--info);
    color: #0c5460;
}

/* --- Empty State --- */
.api-tokens-empty {
    text-align: center;
    padding: var(--space-xl) 0;
    color: var(--neutral-600);
}

.api-tokens-empty i {
    font-size: 3rem;
    color: var(--neutral-400);
    margin-bottom: var(--space-md);
    display: block;
}

.api-tokens-empty p {
    margin-bottom: var(--space-md);
    font-size: 1rem;
}

/* --- API Token Page Responsiveness --- */
/* General .auth-box responsiveness is handled above */
/* Add specific adjustments if needed for the two-column layout */
@media (max-width: 991px) {

    /* Breakpoint where columns stack (Bootstrap lg) */
    .api-token-page .row {
        gap: var(--space-lg) 0;
        /* Ensure gap when stacked */
    }

    .api-token-page .auth-box {
        margin-bottom: var(--space-lg);
        /* Add margin between stacked boxes */
    }

    .api-token-page .col-lg-8,
    .api-token-page .col-lg-4 {
        margin-bottom: var(--space-lg);
        /* Add space below each column when stacked */
    }

    .api-token-page .col-lg-8:last-child,
    .api-token-page .col-lg-4:last-child {
        margin-bottom: 0;
        /* Remove margin from last item */
    }
}

@media (max-width: 576px) {

    /* Adjust padding inside auth-box for smaller screens */
    .auth-box-body,
    .auth-box-header {
        padding: var(--space-md);
    }

    .token-list-box .table-responsive {
        padding: var(--space-md);
        padding-bottom: 0;
    }

    .token-list-box .api-tokens-pagination {
        padding: var(--space-sm) var(--space-md);
    }

    /* Make table scrollable within the box */
    .token-list-box .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        /* Smooth scrolling on iOS */
    }

    .token-list-box .table {
        /* display: block; */
        /* Avoid display:block if possible */
        min-width: 600px;
        /* Force horizontal scroll if needed */
    }

    .token-list-box .table th,
    .token-list-box .table td {
        padding: var(--space-sm) var(--space-md);
        font-size: 0.9rem;
        white-space: nowrap;
        /* Prevent wrapping in table cells */
    }

    /* Adjust pagination for small screens */
    .token-list-box .api-tokens-pagination .pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
}