/* ===== RESET AND BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --primary-dark: #5a6fd8;
    --secondary-color: #764ba2;
    --success-color: #48bb78;
    --warning-color: #ed8936;
    --error-color: #f56565;
    --bg-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --text-dark: #2d3748;
    --text-gray: #718096;
    --text-light: #a0aec0;
    --bg-white: #ffffff;
    --bg-gray: #f7fafc;
    --border-color: #e2e8f0;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 15px 35px rgba(0, 0, 0, 0.15);
    --radius: 12px;
    --radius-lg: 16px;
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-gradient);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
    color: var(--text-dark);
}

/* ===== CONTAINER AND LAYOUT ===== */
.container {
    max-width: 440px;
    margin: 0 auto;
}

.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    backdrop-filter: blur(10px);
}

/* ===== TYPOGRAPHY ===== */
h1 {
    text-align: center;
    color: var(--text-dark);
    margin-bottom: 20px;
    font-size: 26px;
    font-weight: 700;
}

h2 {
    color: var(--text-dark);
    margin-bottom: 15px;
    font-size: 20px;
    font-weight: 600;
}

h3 {
    color: var(--text-dark);
    margin-bottom: 12px;
    font-size: 18px;
    font-weight: 600;
}

h4 {
    color: var(--text-dark);
    margin-bottom: 10px;
    font-size: 16px;
    font-weight: 600;
}

/* ===== USER INFO ===== */
.user-info {
    margin-bottom: 20px;
}

.user-details {
    background: var(--bg-gray);
    padding: 15px;
    border-radius: var(--radius);
    border-left: 4px solid var(--primary-color);
    font-size: 14px;
    color: var(--text-gray);
}

.user-details strong {
    color: var(--text-dark);
}

/* ===== TABS ===== */
.tab-container {
    display: flex;
    margin-bottom: 25px;
    background: var(--bg-gray);
    border-radius: var(--radius);
    padding: 5px;
    gap: 5px;
}

.tab {
    flex: 1;
    text-align: center;
    padding: 12px 8px;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-gray);
}

.tab.active {
    background: var(--bg-white);
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { 
        opacity: 0; 
        transform: translateY(10px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

/* ===== SECTION HEADERS ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-header h3 {
    margin: 0;
    color: var(--text-dark);
}

.btn-refresh {
    background: var(--primary-color);
    color: var(--bg-white);
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-refresh:hover {
    background: var(--primary-dark);
    transform: scale(1.05);
}

/* ===== LOADING STATES ===== */
.loading {
    text-align: center;
    padding: 30px;
    color: var(--text-gray);
    font-size: 16px;
}

/* ===== RESULTS AND MESSAGES ===== */
.result {
    padding: 12px;
    margin: 15px 0;
    border-radius: var(--radius);
    text-align: center;
    font-weight: 500;
    display: none;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from { 
        opacity: 0; 
        transform: translateX(-20px); 
    }
    to { 
        opacity: 1; 
        transform: translateX(0); 
    }
}

.result.success {
    background: #c6f6d5;
    color: #22543d;
    border: 1px solid #9ae6b4;
}

.result.error {
    background: #fed7d7;
    color: #742a2a;
    border: 1px solid #feb2b2;
}

/* ===== ACCOUNT LIST STYLES ===== */
.account-list {
    margin: 15px 0;
}

.account-item {
    background: var(--bg-white);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    margin: 12px 0;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.account-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.account-info {
    flex: 1;
}

.account-name {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 16px;
    margin-bottom: 4px;
}

.account-email {
    font-size: 13px;
    color: var(--text-gray);
    margin-bottom: 2px;
}

.account-id {
    font-size: 12px;
    color: var(--text-light);
    font-family: monospace;
}

.account-actions {
    display: flex;
    gap: 8px;
}

.btn-view, .btn-unlink {
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition);
    min-width: 70px;
}

.btn-view {
    background: var(--success-color);
    color: var(--bg-white);
}

.btn-view:hover {
    background: #38a169;
    transform: scale(1.05);
}

.btn-unlink {
    background: var(--error-color);
    color: var(--bg-white);
}

.btn-unlink:hover {
    background: #e53e3e;
    transform: scale(1.05);
}

/* ===== ACCOUNT DETAILS STYLES ===== */
.account-details {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 0;
    margin-bottom: 20px;
    border: 2px solid var(--border-color);
}

.details-header {
    background: var(--bg-gradient);
    color: var(--bg-white);
    padding: 20px;
    border-radius: 14px 14px 0 0;
    display: flex;
    align-items: center;
    gap: 15px;
}

.back-button {
    background: rgba(255, 255, 255, 0.2);
    color: var(--bg-white);
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    backdrop-filter: blur(10px);
    transition: var(--transition);
}

.back-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(-2px);
}

.details-header h3 {
    margin: 0;
    font-size: 18px;
    flex: 1;
    color: var(--bg-white);
}

.details-content {
    padding: 20px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-item .label {
    font-weight: 600;
    color: var(--text-gray);
    font-size: 14px;
}

.detail-item .value {
    font-weight: 500;
    color: var(--text-dark);
    font-size: 14px;
    text-align: right;
}

.value.online {
    color: var(--success-color);
    font-weight: 600;
}

.value.offline {
    color: var(--error-color);
    font-weight: 600;
}

/* ===== ACTIONS PANEL ===== */
.actions-panel {
    background: var(--bg-gray);
    padding: 20px;
    border-radius: 0 0 14px 14px;
    border-top: 1px solid var(--border-color);
}

.actions-panel h4 {
    margin-bottom: 15px;
    color: var(--text-dark);
    font-size: 16px;
    text-align: center;
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.action-btn {
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-white);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    text-align: center;
    font-size: 13px;
}

.action-btn:hover {
    background: var(--primary-color);
    color: var(--bg-white);
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

.action-btn.danger {
    border-color: #feb2b2;
    color: #e53e3e;
}

.action-btn.danger:hover {
    background: #e53e3e;
    color: var(--bg-white);
    border-color: #e53e3e;
}

/* ===== FORM ELEMENTS ===== */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
}

.input-group input {
    width: 100%;
    padding: 14px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 16px;
    transition: var(--transition);
    background: var(--bg-white);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-hint {
    font-size: 12px;
    color: var(--text-gray);
    margin-top: 5px;
}

/* ===== BUTTON GROUPS ===== */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}

button {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    transition: var(--transition);
}

.btn-primary {
    background: var(--bg-gradient);
    color: var(--bg-white);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.btn-secondary {
    background: var(--border-color);
    color: var(--text-gray);
}

.btn-secondary:hover {
    background: #cbd5e0;
    transform: translateY(-1px);
}

.btn-danger {
    background: #fed7d7;
    color: #c53030;
}

.btn-danger:hover {
    background: #feb2b2;
    transform: translateY(-1px);
}

/* ===== STATISTICS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--bg-gradient);
    color: var(--bg-white);
    padding: 20px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.2);
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 12px;
    opacity: 0.9;
}

/* ===== INFO BOXES ===== */
.info-box {
    background: #ebf8ff;
    border: 1px solid #bee3f8;
    border-radius: var(--radius);
    padding: 15px;
    margin-top: 20px;
}

.info-box h4 {
    color: #2b6cb0;
    margin-bottom: 8px;
    font-size: 14px;
}

.info-box p {
    color: #2c5282;
    font-size: 13px;
    line-height: 1.5;
}

/* ===== EMPTY STATES ===== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-gray);
}

.empty-state div:first-child {
    font-size: 48px;
    margin-bottom: 10px;
}

/* ===== FOOTER ===== */
.footer {
    text-align: center;
    color: var(--bg-white);
    font-size: 14px;
    opacity: 0.8;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .card {
        padding: 20px;
    }
    
    .tab {
        font-size: 12px;
        padding: 10px 5px;
    }
    
    .account-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .account-actions {
        width: 100%;
        justify-content: space-between;
    }
    
    .btn-view, .btn-unlink {
        flex: 1;
        text-align: center;
    }
    
    .action-buttons {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .details-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .back-button {
        align-self: flex-start;
    }
    
    .section-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .btn-refresh {
        width: 100%;
    }
}

/* ===== DARK THEME SUPPORT ===== */
@media (prefers-color-scheme: dark) {
    :root {
        --text-dark: #f7fafc;
        --text-gray: #cbd5e0;
        --text-light: #a0aec0;
        --bg-white: #2d3748;
        --bg-gray: #4a5568;
        --border-color: #718096;
    }
    
    .card {
        background: var(--bg-white);
    }
    
    .account-item, .account-details {
        background: var(--bg-gray);
        border-color: var(--border-color);
    }
    
    .input-group input {
        background: var(--bg-gray);
        border-color: var(--border-color);
        color: var(--text-dark);
    }
    
    .actions-panel {
        background: var(--bg-gray);
    }
    
    .info-box {
        background: var(--bg-gray);
        border-color: var(--border-color);
    }
    
    .btn-secondary {
        background: var(--border-color);
        color: var(--text-dark);
    }
    
    .btn-danger {
        background: #4a5568;
        color: #fc8181;
    }
    
    .btn-danger:hover {
        background: #e53e3e;
        color: var(--bg-white);
    }
}

/* ===== ANIMATIONS ===== */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.pulse {
    animation: pulse 2s infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spin {
    animation: spin 1s linear infinite;
}

/* ===== SCROLLBAR STYLING ===== */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-gray);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-dark);
}

/* ===== ACCESSIBILITY ===== */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
button:focus-visible,
input:focus-visible,
.tab:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --border-color: #000000;
        --shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    }
    
    .account-item:hover {
        border-width: 3px;
    }
}