/* Component Styles */
@import 'variables.css';

/* Header */
.header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: 2rem;
}

.header h1 {
    font-size: clamp(1.5rem, 4vw, 1.75rem);
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-actions {
    display: flex;
    gap: var(--spacing-md);
    flex-wrap: wrap;
}

.header-actions button, .logout-btn {
    text-decoration: none;
    font-size: clamp(0.8rem, 2vw, 0.9rem);
    color: var(--light-text-color);
    background: var(--surface-color);
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
}

.header-actions button:hover, .logout-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Simulate Button Animation */
#simulate-btn {
    position: relative;
    overflow: hidden;
}

#simulate-btn.loading {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    cursor: not-allowed;
}

#simulate-btn.loading::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.7), transparent);
    animation: loading-animation 1.5s infinite;
}

@keyframes loading-animation {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* User Card */
.user-card {
    background-color: var(--surface-color);
    border-radius: 12px;
    padding: var(--spacing-lg);
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-lg);
}

.user-info { flex-shrink: 0; }
.user-info .username { font-weight: 600; font-size: clamp(1.1rem, 3vw, 1.2rem); }
.user-info .phone { color: var(--light-text-color); }

.credits-display {
    font-size: clamp(1.1rem, 3vw, 1.2rem);
    font-weight: 600;
    text-align: right;
    flex-grow: 1;
}

.credits-display .balance {
    color: var(--primary-color);
    transition: transform 0.2s ease-out;
    display: inline-block;
}

.credits-display .balance.updated {
    transform: scale(1.15);
}

/* Username Form */
.username-form { display: flex; gap: var(--spacing-sm); flex-wrap: wrap; align-items: center; }

.username-form input { 
    border: 1px solid var(--border-color); 
    padding: var(--spacing-sm); 
    border-radius: 6px; 
    min-width: 150px;
}

.username-form button {
    border: none;
    background: var(--primary-color);
    color: white;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: 6px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: background-color 0.2s;
}

/* Toast with update button */
.toast .toast-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.toast button {
    background-color: white;
    color: var(--primary-color);
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    margin-left: 12px;
    cursor: pointer;
    font-weight: 500;
}

/* Credits Management */
.credits-section {
    margin-top: 2rem;
}

.credits-card {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.credits-info {
    text-align: center;
}

.credits-balance {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0.5rem 0;
}

.credits-description {
    color: var(--light-text-color);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.credits-actions {
    display: flex;
    justify-content: center;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background-color: var(--background-color);
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    opacity: 0;
    animation: slideIn 0.3s ease-out forwards;
}

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

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

.modal-header h3 {
    margin: 0;
    color: var(--heading-color);
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--light-text-color);
    transition: color 0.2s;
}

.close-modal:hover {
    color: var(--text-color);
}

.modal-body {
    padding: 1.5rem;
}

/* Credits Purchase Form */
.credits-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.credits-option {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--card-bg);
    cursor: pointer;
    transition: all 0.3s ease;
}

.credits-option.selected {
    border-color: var(--primary-color);
    background-color: rgba(12, 130, 119, 0.05);
}

.credits-option-amount {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.credits-option-count {
    color: var(--light-text-color);
    font-size: 0.9rem;
}

.credits-option-popular,
.credits-option-value {
    position: absolute;
    top: -10px;
    right: -10px;
    background-color: var(--primary-color);
    color: white;
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-weight: 600;
}

.credits-option-value {
    background-color: #f59e0b; /* Amber 500 */
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    background-color: var(--input-bg);
    color: var(--text-color);
    transition: border-color 0.2s;
}

.form-group input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.form-group small {
    display: block;
    color: var(--light-text-color);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* STK Push Status */
.stk-status-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem;
}

.stk-status-icon {
    margin-bottom: 1.5rem;
    position: relative;
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stk-spinner {
    width: 64px;
    height: 64px;
    border: 4px solid rgba(12, 130, 119, 0.1);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.stk-success, .stk-error {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

.stk-error {
    color: #ef4444; /* Red 500 */
}

.stk-status-message {
    margin-bottom: 1.5rem;
}

.stk-status-actions {
    display: flex;
    gap: 1rem;
}

.hidden {
    display: none;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    position: relative;
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
}

.primary-btn:hover {
    background-color: var(--primary-dark);
}

.secondary-btn {
    background-color: var(--border-color);
    color: var(--text-color);
}

.secondary-btn:hover {
    background-color: var(--light-text-color);
    color: white;
}

.btn .spinner {
    margin-left: 0.5rem;
} 