* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.title {
    color: #2c3e50;
    font-size: 2.5em;
    margin-bottom: 10px;
    font-weight: 700;
    text-align: center;
}

.subtitle {
    color: #7f8c8d;
    margin-bottom: 30px;
    font-size: 1.1em;
    text-align: center;
}

/* Global Timer */
.global-timer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
    padding: 15px 20px;
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border-radius: 15px;
    color: white;
    box-shadow: 0 8px 20px rgba(52, 152, 219, 0.3);
}

.timer-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.timer-value {
    font-size: 1.8em;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    min-width: 50px;
    text-align: center;
}

.timer-ring {
    width: 50px;
    height: 50px;
}

.timer-ring-circle {
    stroke: rgba(255, 255, 255, 0.3);
    stroke-width: 3;
    fill: transparent;
    r: 22;
    cx: 25;
    cy: 25;
}

.timer-ring-progress {
    stroke: #fff;
    stroke-width: 3;
    fill: transparent;
    r: 22;
    cx: 25;
    cy: 25;
    stroke-dasharray: 138.2;
    stroke-dashoffset: 138.2;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
    transition: stroke-dashoffset 1s linear;
}

/* TOTP Rows */
.totp-rows {
    margin-bottom: 20px;
}

.totp-row {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 20px;
    margin-bottom: 15px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.totp-row:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.totp-row.active {
    border-color: #27ae60;
    background: linear-gradient(135deg, #f8fff9 0%, #e8f5e8 100%);
}

/* Desktop Layout - Single Row */
.top-row, .bottom-row {
    display: contents; /* Make these containers invisible on desktop */
}

/* User ID Input */
.userid-group {
    flex: 2;
    min-width: 150px;
}

.userid-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.userid-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.userid-input::placeholder {
    color: #bdc3c7;
}

/* Import Button */
.import-btn {
    background: linear-gradient(45deg, #667eea, #764ba2);
    color: white;
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.import-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.import-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Code Display */
.code-display {
    flex: 2;
    text-align: center;
    min-width: 150px;
}

.code-container {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    border-radius: 10px;
    padding: 15px;
    color: white;
    box-shadow: 0 4px 15px rgba(44, 62, 80, 0.3);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.totp-code {
    font-size: 1.8em;
    font-weight: 700;
    letter-spacing: 0.2em;
    font-family: 'Courier New', monospace;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.empty-code {
    font-size: 1em;
    color: #bdc3c7;
    font-weight: 400;
    letter-spacing: normal;
}

/* Copy Button */
.copy-btn {
    background: linear-gradient(45deg, #27ae60, #2ecc71);
    color: white;
    padding: 12px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}

.copy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(39, 174, 96, 0.3);
}

.copy-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.copy-btn.copied {
    background: linear-gradient(45deg, #f39c12, #e67e22);
}

/* Delete Button */
.delete-btn {
    background: linear-gradient(45deg, #e74c3c, #c0392b);
    color: white;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.delete-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(231, 76, 60, 0.3);
}

/* Add Row Button */
.add-row-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(45deg, #2ecc71, #27ae60);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.add-row-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(46, 204, 113, 0.3);
}

.add-icon {
    font-size: 20px;
    font-weight: 700;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    color: white;
    text-align: center;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 20px 15px;
    }
    
    .title {
        font-size: 2em;
    }
    
    .subtitle {
        font-size: 1em;
        margin-bottom: 20px;
    }
    
    /* Compact Global Timer for Mobile */
    .global-timer {
        padding: 12px 15px;
        margin-bottom: 20px;
        gap: 10px;
    }
    
    .timer-label {
        font-size: 11px;
    }
    
    .timer-value {
        font-size: 1.5em;
        min-width: 40px;
    }
    
    .timer-ring {
        width: 40px;
        height: 40px;
    }
    
    .timer-ring-circle,
    .timer-ring-progress {
        r: 16;
        cx: 20;
        cy: 20;
        stroke-width: 2.5;
    }
    
    .timer-ring-progress {
        stroke-dasharray: 100.5;
        stroke-dashoffset: 100.5;
    }
    
    /* Mobile Row Layout */
    .totp-row {
        flex-direction: column;
        gap: 12px;
        padding: 15px;
        margin-bottom: 12px;
        border-radius: 10px;
    }
    
    /* Top Row: User ID + Import Button */
    .top-row {
        display: flex;
        gap: 10px;
        width: 100%;
    }
    
    .userid-group {
        flex: 1;
        min-width: auto;
    }
    
    .import-btn {
        flex-shrink: 0;
        padding: 12px 16px;
        font-size: 13px;
    }
    
    /* Bottom Row: Code + Copy Button + Delete Button */
    .bottom-row {
        display: flex;
        gap: 10px;
        width: 100%;
        align-items: center;
    }
    
    .code-display {
        flex: 1;
        min-width: auto;
    }
    
    .code-container {
        padding: 10px 8px;
        min-height: 45px;
    }
    
    .totp-code {
        font-size: 1.3em;
        letter-spacing: 0.1em;
    }
    
    .empty-code {
        font-size: 0.9em;
    }
    
    .copy-btn {
        flex-shrink: 0;
        padding: 12px 14px;
        font-size: 13px;
    }
    
    .delete-btn {
        flex-shrink: 0;
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
    
    /* Add Row Button */
    .add-row-btn {
        padding: 12px;
        font-size: 14px;
        margin-top: 10px;
    }
    
    .add-icon {
        font-size: 18px;
    }
}

/* Success/Error States */
.success-flash {
    animation: successFlash 0.5s ease-in-out;
}

.error-flash {
    animation: errorFlash 0.5s ease-in-out;
}

@keyframes successFlash {
    0%, 100% { background: white; }
    50% { background: #d5f4e6; }
}

@keyframes errorFlash {
    0%, 100% { background: white; }
    50% { background: #fadbd8; }
}
