/* User Modal System CSS - Based on gemini-api-modal structure */

.user-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
}

.user-modal.active, .user-modal[style*="display: block"], .user-modal[style*="display: flex"] {
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.user-modal .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.user-modal .modal-content {
    margin: auto;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    position: relative;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    z-index: 1;
    animation: modalSlideIn 0.3s ease-out;
}

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

.user-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 24px 16px;
    border-bottom: 1px solid #e8eaed;
}

.user-modal .modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 500;
    color: #202124;
}

.user-modal .modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-modal .modal-close:hover {
    background-color: rgba(95, 99, 104, 0.1);
}

.user-modal .modal-close .material-icons {
    font-size: 20px;
    color: #5f6368;
}

.user-modal .modal-body {
    padding: 24px;
}

/* Modal Panel System */
.modal-panel {
    display: none;
}

.modal-panel.active {
    display: block;
    padding-bottom: 50px;
}

/* Form Styling */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #202124;
    font-size: 14px;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #dadce0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: #4285f4;
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}

/* Button Styling */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background-color: #4285f4;
    color: white;
}

.btn-primary:hover {
    background-color: #3367d6;
}

.btn-secondary {
    background-color: #f8f9fa;
    color: #3c4043;
    border: 1px solid #dadce0;
}

.btn-secondary:hover {
    background-color: #e8eaed;
}

.btn-danger {
    background-color: #ea4335;
    color: white;
}

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

/* Form Messages */
.form-message {
    margin-top: 12px;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    display: none;
}

.form-message.success {
    background-color: #e8f5e8;
    color: #137333;
    border: 1px solid #b3d6b3;
}

.form-message.error {
    background-color: #fce8e6;
    color: #d93025;
    border: 1px solid #f9ab9d;
}

.form-message.info {
    background-color: #e8f0fe;
    color: #1967d2;
    border: 1px solid #aecbfa;
}

/* Modal Footer */
.modal-footer {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e8eaed;
    text-align: center;
}

.modal-footer p {
    margin: 0;
    font-size: 14px;
    color: #5f6368;
}

.modal-footer a {
    color: #4285f4;
    text-decoration: none;
}



/* Switch Panel Links */
.switch-panel {
    color: #4285f4;
    text-decoration: none;
    cursor: pointer;
}

.switch-panel:hover {
    text-decoration: underline;
}

/* Account Tabs */
.account-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 1px solid #e8eaed;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: #5f6368;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab-btn.active {
    color: #4285f4;
    border-bottom-color: #4285f4;
}

.tab-btn:hover {
    color: #4285f4;
    background-color: rgba(66, 133, 244, 0.04);
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}




/* Logout Button */
a.btn.btn-danger.logout-btn {
    width: 100%;
    margin-top: 16px;
    border: 1px solid #ddd;
    border-radius: 5px;
    padding: 5px;
    color: #a5a5a5 !important;
    text-decoration: none;
    background: #fff;
}

a.btn.btn-danger.logout-btn:hover{
    color: #ea4335!important;
    background-color: rgba(234, 67, 53, 0.1);
    border-color: #ea4335;
}



/* Clear API Session Button */
.clear-api-session-btn {
    display: none; /* Initially hidden */
}

.clear-api-session-btn.show {
    display: inline-block; /* Show when needed */
}

/* Profile tab button spacing */
#profileTab .clear-api-session-btn {
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

#profileTab .clear-api-session-btn .material-symbols-outlined {
    font-size: 18px;
}

/* Setup Button Styling */
.setup-button-section {
    /* margin-top: 16px; */
    text-align: center;
}

.setup-api-btn {
    background: linear-gradient(45deg, #211f8d, #2f2ccf);
    color: white !important;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.setup-api-btn:hover {
    background: linear-gradient(45deg, #1a1a6f, #2626b3);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.setup-api-btn .material-icons {
    font-size: 18px;
}


.iforai-account-buttons {
    display: flex;
    gap: 10px;
}

button.btn-outline-primary.show-account-modal {
    padding: 10px;
    width: 46px;
    height: 46px;
    display: flex;
    border-radius: 100%;
    border: none;
    justify-content: center;
    align-items: center;
    background: #f4f9fe;
}

button.btn-outline-primary.show-account-modal span.material-icons{
    font-size: 24px;
    color: #4285f4;
}

/* Confirmation Modal Styles */
.confirmation-modal .modal-content {
    max-width: 450px;
    width: 90%;
}

.confirmation-content {
    text-align: center;
    padding: 20px 0;
}

.confirmation-icon {
    margin-bottom: 20px;
}

.confirmation-icon .material-symbols-outlined {
    font-size: 48px;
    color: #ff9800;
}

.confirmation-message {
    font-size: 16px;
    color: #333;
    margin: 0;
    line-height: 1.5;
}

.confirmation-modal .modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 20px 30px;
    border-top: 1px solid #e5e7eb;
}

.confirmation-modal .btn {
    min-width: 80px;
}

.confirmation-modal .btn-secondary {
    background-color: #6b7280;
    color: white;
    border: none;
}

.confirmation-modal .btn-secondary:hover {
    background-color: #4b5563;
}

.confirmation-modal .btn-danger {
    background-color: #dc2626;
    color: white;
    border: none;
}

.confirmation-modal .btn-danger:hover {
    background-color: #b91c1c;
}

.iforai-auth-buttons {
    display: flex;
    flex-direction: row;
    gap: 8px;
     font-family: 'Varela Round';
}

.btn-outline-primary.show-login-modal {
    padding: 10px 10px;
    height: 38px;
    display: flex;
    border-radius: 6px;
    border: 1px solid #bad9f8;
    justify-content: center;
    align-items: center;
    background: #fff;
    font-size: 14px;
    gap: 10px;
    color: #4285f4;
}

.btn-outline-primary.show-login-modal:hover{
    border:1px solid #4285f4;
    color: #4285f4;
    box-shadow: none;
}

.btn-outline-primary.show-login-modal .material-icons{
    transition: transform 0.2s ease;
}

.btn-outline-primary.show-login-modal:hover .material-icons {
  transform: translateX(4px);
}

.btn-primary.show-register-modal {
    background: #4285f4;
    padding: 10px 10px;
    height: 38px;
    display: flex;
    border-radius: 6px;
    border:1px solid transparent;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    gap: 10px;
    color: #fff;
}

.btn-primary.show-register-modal:hover{
    border:1px solid #211f8d;
    color: #fff;
    box-shadow: none;
    background-color: #211f8d;
}


.btn-primary.show-register-modal .material-icons{
    transition: transform 0.2s ease;
}

.btn-primary.show-register-modal:hover .material-icons {
  transform: translateX(4px);
}

#userModal .btn{
    width:100%;
     font-family: 'Varela Round';
     font-size: 14px;
}

/* User Modal Usage Tab Styles */
.iforai-usage-wrapper {
  margin: 0 0 24px 0;
  padding: 24px 0 0 0;
}

.iforai-usage-apikey-md5 {
    margin: -10px 0 0 20px;
    color: #d8d8d8;
    background: #ffffff;
    font-size: 14px;
}

.iforai-usage-list {
    margin-top: 8px;
    background: #f7f7f7;
    border: 1px solid #e7e7e7;
    border-radius: 20px;
    padding: 20px;
    overflow-y: scroll;
    height: 150px;
}
.iforai-usage-date-group {
  margin-bottom: 18px;
}

.iforai-usage-date {
    font-size: 14px;
    color: #c9c9c9;
    margin-bottom: 4px;
    font-family: 'Roboto Mono';
}

.iforai-usage-entries {
  list-style: none;
  padding: 0;
  margin: 0 0 0 8px;
}
.iforai-usage-entry {
    font-size: 14px;
    color: #444;
    margin-bottom: 2px;
    display: flex;
    gap: 8px;
    align-items: center;
    font-family: 'Varela Round';
}
.iforai-usage-time {
    color: #8694ab;
    font-weight: 500;
}
.iforai-usage-tokens {
    color: #198754;
    font-family: 'Roboto Mono';
}
.iforai-usage-model {
    color: #e1dede;
}

.iforai-usage-loading {
  color: #888;
  font-size: 1rem;
  padding: 24px 0;
  text-align: center;
}
.iforai-usage-empty {
  color: #b91c1c;
  font-size: 1rem;
  padding: 24px 0;
  text-align: center;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .user-modal .modal-content {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        border: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        animation: modalSlideInMobile 0.3s ease-out;
    }
    
    .user-modal .modal-header {
        padding: 16px 16px 12px;
        border-bottom: 1px solid #e8eaed;
        background: white;
        position: sticky;
        top: 0;
        z-index: 10;
    }
    
    .user-modal .modal-body {
        padding: 16px;
        flex: 1;
        overflow-y: auto;
    }
    
    .account-tabs {
        flex-direction: column;
        gap: 0;
        margin-bottom: 16px;
    }
    
    .tab-btn {
        text-align: left;
        border-bottom: 1px solid #e8eaed;
        border-radius: 0;
        padding: 12px 16px;
    }
    
    .tab-btn.active {
        background-color: #f8f9fa;
    }

    button.btn-outline-primary.show-account-modal{
        width:35px;
        height: 35px;
    }
    
    /* Mobile animation */
    @keyframes modalSlideInMobile {
        from {
            opacity: 0;
            transform: translateY(100%);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    /* Form elements mobile optimization */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
    }
    
    .btn {
        padding: 12px 16px;
        font-size: 16px;
        width: 100%;
    }
    
    .modal-actions {
        padding: 16px;
        border-top: 1px solid #e8eaed;
        background: white;
        position: sticky;
        bottom: 0;
    }
	
	.show-register-modal .auth-button-text{
        display: none;
    }
}